8/27/2012

Get help with Powershell -examples



Sitting at Mikael Nyströms Windows Server 2012 lab I yet again realize that it's never too late to get help... when it comes to powershell :)
I'm not a Powershell Guru (...yet,but to be Jedi I want) and until that day emerges I need to Get-Help, so Powershell help to the rescue!

Searching for help with Powershell ISE
Powershell ISE is useful for building, debugging, testing scripts and copy-pasting instead of using Powershell and Notepad. Other than that I find it useful when getting help.
Run Powershell ISE and open Commands by either running Show-Command or click Show Command Window.

Show Command Window

Type in New-virtual and select the New-VirtualDisk cmdlet, click the field next to FriendlyName* and click F1 to bring up Help and notice that you can use the Search field to find cmdlets etc.





Getting help and detailed examples
Type Get-Help
 get- and notice the snippet window with examples that you can run, type get-v and use TAB to complete the command Get-Help Get-VirtualDisk and hit Enter.
Snippets

If you get promted to update help select Yes and use the Up Arrow key to re-select the latest command Get-Help Get-VirtualDisk.
At the end of the page under Remarks note that you can view examples, detailed, full and -Online.
If you type Get-Help Get-VirtualDisk -Online (Unfortunately some cmdlets are not yet present in the help file)

And there are a lot of other ways to get help, if you haven't visited The Scripting Guys blog -do, or if you're Swedish, you can download the free e-book "Kom igång med Powershell" from Niklas Goudes site and my favorite page (one of many) is a list of Powershell cmdlets at Technet


Inga kommentarer:

Skicka en kommentar