This is one cmdlet that Microsoft has really improved with recent versions of PowerShell. It has a TON of information about every cmdlet you might run. Even though the default is to usually run out and do a search on Google for the cmdlet you are looking for I would suggest starting with Get-Help. You’d be surprised how much information it contains.
The basic use looks like this…
This will return all of the help information available for Get-Help, but wait there’s more!
If you combine Get-Help with another cmdlet (like the one’s below) it will show you the help for each of those cmdlets!
Get-Help of another cmdlet.
This is another “help” type cmdlet. If you ever want to know what cmdlets are available to you at any given time then this is what you would run…
This cmdlet will return all of the services that are currently running on your computer/server.
It can be combined with other cmdlets to do a variety of things, but one of the most common is to start or stop a service.
Get-Service Spooler | Stop-Service
BE CAREFUL if you run the Stop-Service cmdlet on a production server, because you may stop something you didn’t mean to! FYI…If you do stop something you shouldn’t you can easily restart it with this cmdlet.
Get-Service Spooler | Start-Service
Import-CSV and Export-Csv
This may be one of the single most import cmdlets to learn to use. PowerShell is all about getting information and doing something with that information. One way we have to get information into and out of the Shell is through Import/Export-Csv. Let’s say you had a list of servers that you wanted to run a script against, this is the cmdlet that you can use to import that list of servers and then DO something with them. There are plenty of other ways to get information into your scripts, but this is probably one of the first you will use and ,for me, one of the most versitle.
#Import from File
Import-Csv processlist.csv | Get-Process $_.ProcessName
#Export to File
Get-Process | Export-Csv allprocesses.csv
Clip is one that I didn’t find out about for a while, but what a cool little cmdlet this is. If you add this to ANY cmdlet it will copy the output of that cmdlet to the clipboard on your P.C. From there all you have to do is paste it into your favorite text editor to view, edit and save the information.
As always your feedback is really appreciated so make sure to leave some comments!