Using the Get-Command cmdlet in PowerShell, you can get the list of all available parameters for the PowerShell cmdlet. Get-Command cmdlet gets cmdlet all parameters that include required as well as optional parameters.
You can also use the Get-Help cmdlet in PowerShell to get parameters for cmdlets. Using the Get-Help cmdlet, we can apply a filter to get the required or optional parameters available for the PowerShell cmdlet.
In this article, we will discuss how to use Get-Command and Get-Help cmdlets in PowerShell to get a list of all available parameters for cmdlet.
Get-Command to Get all Parameters for Cmdlet
Use the Get-Command cmdlet to get a list of all available parameters for the PowerShell cmdlet.
(GET-Command Get-ChildItem).Parameters
In the above PowerShell script, Get-Command
uses the exact name of the PowerShell cmdlet Get-ChildItem and uses Parameters to get all parameters for the Get-ChildItem cmdlet.
The output of the above command to get the PowerShell parameter list like Path, LiteralPath, Filter, Recurse, etc…
Using Get-Help to List All Parameters for Cmdlet
You can use the Get-Help cmdlet to get help for PowerShell cmdlets. Using the Get-Help Parameter, you can get the list of all parameters for the cmdlet.
Get-Help Get-ChildItem -Parameter * | Select-Object Name,Required
In the above PowerShell script, the Get-Help cmdlet uses the exact name of the PowerShell cmdlet Get-ChildItem to get all parameters using the Parameter * and piped it to the Select-Object cmdlet.
Select-Object cmdlet displays Name and Required parameters for Get-ChildItem cmdlet parameters.
The output of the above script to get all parameters including required or optional is as below
Conclusion
I hope the above article on how to get a list of all available parameters for PowerShell cmdlets using Get-Command and Get-Help cmdlets is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.