Tuesday, May 31, 2011

Get-Help

I love Get-Help, I really do.

Microsoft has released an update of the CHM help file (PS2.0 Core Help May 2011 Update).  The CHM is easy to search and it is nice to be able to scroll through all of the pages especially when looking at examples.

Get-Help has a few distinguishing benefits over the CHM.  It is there at your fingertips when you are in the shell.  So to quickly to see what your formatted output options are, just "get-help out-*"

Get-Help is also dynamic.  It can grow to contain the functions of modules and PS1 files that have been Dot Included.

Take a look at either help method under "about_Comment_Based_Help".
Function HelloForm {
<#
    .Description 
     Use Winforms Form to show Hello World
#>
    Add-Type -AssemblyName "System.windows.forms"
    $form = New-Object System.Windows.Forms.Form
    $form.Text="Hello World"
    $form.ShowDialog()
}
Get-Help HelloForm

Good Explanation: http://technet.microsoft.com/en-us/magazine/ff458353.aspx