While building a script to help out a reader of this blog, I came up with a handy little cmdlet to retrieve the parameters of a cmdlet and place them into a collection.
Function Get-ParameterList
{
[cmdletBinding()]
Param ($Cmdlet)
Write-Verbose "== Cmdlet: Get-ParameterList =========================="
Write-Verbose "Parameter - `$Cmdlet: $Cmdlet"
$List = (get-help $Cmdlet -parameter * |
Select-Object -Property Name |
ForEach -Process {$_.name})
Write-Verbose "Sending $($List.count) Items to the pipeline."
Write-Output $List
Write-Verbose "__ End Function: Get-ParameterList ____________________"
<#
.SYNOPSIS
Extracts cmdlet parameters
.DESCRIPTION
Extracts the parameters from a supplied cmdelt and sends then as a collection
into the PowerShell Pipeline.
.PARAMETER Cmdlet
The name of the cmdlet whose parameters you want to extract.
.EXAMPLE
Get-ParameterList Set-MailContact
Sends a collection of strings containing the names of all of the parameters
avaliabe to the cmdlet Set-MailContact.
#>
} # End: Cmdlet: Get-ParameterList
Comments