What's your favorite Powershell command or script for system administration? [closed]

What's your top Powershell command? Let's make a list and vote up the best ones!


Get-Member is the king of PowerShell cmdlets.

Get-Member allows you to interactively explore objects' members and types' (with the -static switch) static members.


I like having a script for finding AD users:

$strFilter = "(&(objectCategory=User)(sAMAccountName=[USERNAME]))";
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher;
$objSearcher.SearchRoot = "LDAP://dc=[AD_Location]";
$objSearcher.Filter = $strFilter;
$objSearcher.SearchScope = "Subtree";
$objSearcher.FindALL()

I have to go with get-help. This cmdlet is the key to finding the functionality of other cmdlets. A close second would be get-member.


At the moment I'm a big fan of Get-WMIObject.


"Test-Path" finding this useful for checking if data is already there or if a default needs to be added.