Now Available:

Featured Resource:

line

Newsletter

Email Address:


line

Ask the Expert

Have a question for our resident expert? Email your questions to Greg.

« Really, Really Good (Free) Citrix Training! | Main | Looking for a List of Microsoft Security Blogs? »

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

TrackBack

TrackBack URL for this entry:
http://www.realtime-windowsserver.com/type/mt-tb.cgi/515

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?

Post a comment

(All comments are approved by site leader before appearing here. Thanks for commenting!)

line

Greg Shields' Bio:

Greg Shields, is an independent author, instructor, and IT consultant based in Denver, Colorado, and a co-founder of Concentrated Technology. With nearly 15 years of experience in information technology, Greg has developed extensive experience in systems administration, engineering, and architecture specializing in Microsoft systems management, remote application, and virtualization technologies. Greg is a Contributing Editor for Redmond Magazine, MCPmag.com, and Virtualization Review Magazine and is the author of five books, including Windows Server 2008:  What’s New / What’s Changed. Greg is also a highly sought-after instructor and speaker, speaking regularly at conferences like TechMentor Events, and producing computer-based training curriculum for CBT Nuggets.  Greg is a recipient of Microsoft "Most Valuable Professional" award with a specialization in Windows Terminal Services.