Tuesday, 7 June 2016

List all Parameters for a Cmdlet in Powershell

When you start work with a new Powershell cmdlet, you might want to get a list of all the available parameters in the powershell cmdlet. We can use the command GET-Command to display all the parameters.
 (GET-Command GET-Process).parameters
We can also use the command Get-Help to display all the available parameters with details.
Get-Help GET-Process -Parameter *
If you want to view only required or mandatory parameters in a cmdlet, we can filter the results using Where-Object with Required property.:
Get-Help GET-Process -Parameter * | Where-Object {$_.Required -eq $true}

Advertisements
Advertisements

No comments:

Post a Comment