Public/Get-CommandParameters.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
Function Get-CommandParameters { Param( [Parameter(Mandatory)] [ValidateScript({ if (-Not (Get-Command -Name $_ -ErrorAction SilentlyContinue)) { throw 'Command does not exist' } return $true })] [string]$Command ) $CPara = @( [System.Management.Automation.PSCmdlet]::CommonParameters [System.Management.Automation.PSCmdlet]::OptionalCommonParameters ) (Get-Command -Name $Command).ParameterSets.Parameters | Where-Object {$_.Name -notin $CPara} | Select-Object -Property Name,IsMandatory,Value*,Aliases -Unique | Format-Table -RepeatHeader } |