Don Jones’ Favorite PowerShell Cmdlets, Part 2 of 10: Get-Help
How do you use ConvertTo-HTML? How does Stop-Service work? Can Get-Content retrieve only a specified number of lines from a file? You’ll never know unless you ask for help. Technically, I don’t like the Get-Help cmdlet itself much, because it doesn’t page its output. Instead, I use the built-in Help function, which calls Get-Help and has it page its output:
Help *
This lists all the things Help can help with, and you’ll notice that many “about” topics are included along with all the cmdlet-specific help.
Want to become a PowerShell guru? Read the help for a new cmdlet every day. PowerShell ships with about 130 of them, so you can make it your business day page-a-day calendar, if you like. You don’t need to memorize the help, but do scan through it - you’ll become a lot more familiar with each cmdlet’s capabilities. Of course, running Help by itself might not be informative enough to let you know what a cmdlet can do, so try:
Help Where-Object -full
To get more comprehensive help. Or, if you just want to see examples of a cmdlet in action:
Click past the fold for more…
Help New-Alias -example
You can even ask for help with aliases, and you’ll get the help for the underlying cmdlet:
Help dir
I love Help, and I’m never afraid to use it. In fact, I love it so much that I asked the developers at SAPIEN to come up with a GUI that can display all the available help topics. You can get the PowerShell help utility for free: Just go to www.PrimalScript.com and click on “free tools” in the menu on the left. Help will never be far away.
Don Jones is the Lead Scripting Guru for SAPIEN Technologies and a Windows PowerShell MVP. He’s the co-author of Windows PowerShell: TFM, 2nd Edition and is the Windows PowerShell columnist for TechNet Magazine. Don is also the Director for the new centralized, independent PowerShell online community: www.PowerShellCommunity.org.
Get your hands on the full Don Jones Favorite Cmdlets Series at this address:
http://www.realtime-windowsserver.com/type/mt-search.cgi?tag=don%20jones%20favorite%20cmdlets&blog_id=1

Email This!
Digg it!
Del.icio.us
Reddit!
Newsvine
Comments
I am trying to stop a service on a remote machine ($RemoteComputer = "s310reg2"). Ideally, the code should be something like:
$objRemoteService = Get-WmiObject -ComputerName $RemoteComputer -Class "Win32_Service"
$ServName = $objRemoteService | Where-Object {$_.Name -eq "2Encrypt"}
Stop-Service -Name $ServName -machinename "\\s310reg2"
But I get an error message: "A parameter cannot be found that matches parameter name '\\S310REG2\root\cimv2:Win32_Service.Name="2Encrypt"'."
How can I get the service and stop it?
Posted by: Brian Regan | July 23, 2008 8:27 PM