Here is a clever trick to create cheat sheets for your favorite PowerShell commands.

Any PowerShell command ships via a module, so if you have a PowerShell command that is useful to you, you might want to list all the other (and possibly related) commands that ship in the same module. This line shows how to find the module name for any given command, and lists the module name that ships the Get-WmiObject cmdlet:

 
PS> 
PS> (Get-Command -Name Get-WmiObject).ModuleName
Microsoft.PowerShell.Management 
 

To find all other commands shipped by this module, try this:

 
PS> Get-Command -Module Microsoft.PowerShell.Management

CommandType     Name                                               Version   
-----------     ----                                               -------   
Cmdlet          Add-Computer                                       3.1.0.0   
Cmdlet          Add-Content                                        3.1.0.0   
Cmdlet          Checkpoint-Computer                                3.1.0.0   
Cmdlet          Clear-Content                                      3.1.0.0   
Cmdlet          Clear-EventLog                                     3.1.0.0   
Cmdlet          Clear-Item                                         3.1.0.0   
Cmdlet          Clear-ItemProperty                                 3.1.0.0   
Cmdlet          Clear-RecycleBin                                   3.1.0.0   
 

To create a handy cheat sheet with command names and descriptions, pipe the command into Get-Help, and use Select-Object to pick the detail information from the help that you’d like to add to your cheat sheet:

 
PS> Get-Command -Module Microsoft.PowerShell.Management | Get-Help | Select-Object -Property Name, Synopsis

Name                Synopsis                                                   
----                --------                                                   
Add-Computer        Add the local computer to a domain or workgroup.           
Add-Content         Adds content to the specified items, such as adding word...
Checkpoint-Computer Creates a system restore point on the local computer.      
Clear-Content       Deletes the contents of an item, but does not delete the...
Clear-EventLog      Clears all entries from specified event logs on the loca...
Clear-Item          Clears the contents of an item, but does not delete the ...
Clear-ItemProperty  Clears the value of a property but does not delete the p...
Clear-RecycleBin                                                               
Complete-Transac... Commits the active transaction.                            
Convert-Path        Converts a path from a Windows PowerShell path to a Wind...
Copy-Item           Copies an item from one location to another.               
Copy-ItemProperty   Copies a property and value from a specified location to...
Debug-Process       Debugs one or more processes running on the local computer.
Disable-Computer... Disables the System Restore feature on the specified fil...
Enable-ComputerR... Enables the System Restore feature on the specified file...
Get-ChildItem       Gets the items and child items in one or more specified ...
Get-Clipboard       Gets the current Windows clipboard entry.                  
Get-ComputerInfo    Gets a consolidated object of system and operating syste...
Get-ComputerRest... Gets the restore points on the local computer.             
Get-Content         Gets the content of the item at the specified location.    
Get-ControlPanel... Gets control panel items.                                  
Get-EventLog        Gets the events in an event log, or a list of the event ...
Get-HotFix          Gets the hotfixes that have been applied to the local an...
Get-Item            Gets the item at the specified location.                   
Get-ItemProperty    Gets the properties of a specified item.                   
Get-ItemProperty... Gets the value for one or more properties of a specified...
Get-Location        Gets information about the current working location or a... 
 

If the help information is incomplete, and there is no synopsis information for the commands you chose, you might first have to download the PowerShell help. For that, you’d need a PowerShell with elevated privileges:

 
PS> Update-Help -UICulture en-us -Force 
 

Don’t worry about error messages thrown by this command: it is normal for a few modules to not supply help information. If you get massive numbers of error messages, then you probably did not run the command with elevated privileges. Unfortunately, PowerShell stores its help files along with the modules in file locations that are not accessible to regular users.

Twitter This Tip! ReTweet this Tip!

Anonymous