PowerShell has a number of useful commands and parameters that you may not know exist. Commands like Out-GridView
and Format-Table
are useful for controlling output interactively and parameters like -Confirm
and -WhatIf
make working with scripts easier. Other commands help you find other commands!
Get-Command
lists all commands that are installed on the computer (including cmdlets, aliases, functions, filters, scripts, and applications). The Get-Command
is particularly useful with search parameters. The -Module
parameter lists all commands for a particular module and the -Noun
/-Verb
parameters allow you to search for commands with that particular noun or verb. Other useful parameters include -CommandType
and -ShowCommandInfo
.
Get-Command -Noun Service
Get-Command -Name Get-Service -ShowCommandInfo
Get-Member
pipes the output of another command (an object) to get a list of the properties and methods of that object.
Get-Process | Get-Member
Other useful cmdlets include Get-Module
which displays modules that have been imported into your current PowerShell session and Get-ExecutionPolicy
which shows what your effective execution policy is set to (Restricted, Unrestricted, AllSigned, RemoteSigned, etc.). See About Execution Policies for more details.
Out-GridView
sends the output of a command to a grid that allows you to filter and display different columns interactively.
Get-Process | Select-Object * | Out-GridView

For baselining or exporting data, useful output cmdlets include Export-CSV
(or ConvertTo-CSV
), ConvertTo-XML
, and ConvertTo-JSON
. You can control what your screen output looks like using Format-List
, Format-Table
, and Format-Wide
.
Get-Process | Format-List -Property Name, Path, BasePriority, SessionID
If you are testing a script (or command) and want to see what would have happened if you ran the script, but not actually run the script, use the -WhatIf
parameter. You can also use the -Confirm
parameter to make sure that you really want to run the script (or command).
Finally, don’t forget about Get-Help
(especially using the -Online
or -ShowWindow
parameters).