Powershell : List only required Parameters for a Cmdlet

We can get all the required parameters for a Powershell cmdlet using Get-Help cmdlet. The Get-Help displays the detailed description of all the available parameters if we pass the parameter –Parameter * and we can filter the results using Required property to get only required parameters for a powershell cmdlet.

The following command displays all the available parameters of the Get-Childitem cmdlet.

Get-Help Get-ChildItem -Parameter *

To view only the required parameters, we can filter the results using Where-Object with Required property.:

Get-Help Get-ChildItem -Parameter * | Where-Object {$_.Required -eq $true}
Advertisement

Leave a Comment