Kae Travis

Get Help with PowerShell Cmdlets, Parameters, Methods and Properties

Sometimes we’re struggling to write a script need to get help with PowerShell cmdlets, parameters, methods and properties. Here we explain how we can use get-help to assist us.

Firstly, it’s useful to know which Cmdlets and functions are available in your current PowerShell session. To find this, we can use the following:

#Find cmdlets
Get-Command | where-object CommandType -eq "Cmdlet"
#Find functions
Get-Command | where-object CommandType -eq "Function"

So using this, let’s pretend we want to manipulate processes, so we could use something like this to find cmdlets with the word ‘process’ in them:

Get-Command | where-object { $_.CommandType -eq "Cmdlet" -and $_.Name -like "*process*" } | Select Name

Which returns this:

Name                             
----                             
ConvertTo-ProcessMitigationPolicy
Debug-Process                    
Enter-PSHostProcess              
Exit-PSHostProcess               
Get-Process                      
Get-ProcessMitigation            
Get-PSHostProcessInfo            
Set-ProcessMitigation            
Start-Process                    
Stop-Process                     
Wait-Process    

So from this list, let’s view the help documentation for Get-Process:

Get-Help get-process

And now you may want to drill down into what properties and methods the cmdlet exposes like so:

#properties
get-process | Get-Member -MemberType property
#methods
get-process | Get-Member -MemberType method
Get Help with PowerShell Cmdlets, Parameters, Methods and Properties
Get Help with PowerShell Cmdlets, Parameters, Methods and Properties

Leave a Reply