Timmy Fell In The Well! – Get-Help To The Rescue
Timmy was always getting into some sort of trouble, wasn’t he? The famous collie running through the fields, may not be the first thing that comes to mind for a good PowerShell analogy, it does apply. Think about it. Timmy ran into trouble,and he told Lassie to “Get-Help”. Get-Help is one of the most useful PowerShell cmdlets you will ever use.
What does it do?
Get-Help provides well, help, about a given cmdlet, it’s parameters, uses, examples, and other bits of useful information. Pending the vendor of the cmdlet built that information in. Lets take a look at an example: “Get-Help Get-Help –Detailed”
PS C:\> Get-Help Get-Help
NAME
Get-Help
SYNOPSIS
Displays information about Windows PowerShell cmdlets and concepts.
SYNTAX
Get-Help [-Category <string[]>] [-Component <string[]>] [-Full] [-Functionality <string[]>] [-Online] [-Role <strin
g[]>] [[-Name] <string>] [<CommonParameters>]
Get-Help [-Category <string[]>] [-Component <string[]>] [-Detailed] [-Functionality <string[]>] [-Online] [-Role <s
tring[]>] [[-Name] <string>] [<CommonParameters>]
It goes on and on actually, but the above should give you an idea. In the context of Virtualization and PowerShell this is really really (yes that gets two ‘really’ marks, it’s that useful). Say you looked at our sildes and wanted to know more about creating a new XenServer VM, you could simply “Get-Help” the cmdlet:
PS C:\> get-help Create-XenServer:VM
NAME
Create-XenServer:VM
SYNOPSIS
SYNTAX
Create-XenServer:VM [-BestEffort [<SwitchParameter>]] [-RunAsync [<SwitchPa
rameter>]] [-HashTable [<Hashtable>]] [<CommonParameters>]
DETAILED DESCRIPTION
Create a new VM instance, and return its handle.
RELATED LINKS
REMARKS
To see the examples, type: "get-help Create-XenServer:VM -examples".
For more information, type: "get-help Create-XenServer:VM -detailed".
For technical information, type: "get-help Create-XenServer:VM -full".
Like that actually. Not as helpful as it could be, but a start. Lets look at the ‘-detailed’ information. (output truncated, it’s A LOT of information:
PARAMETERS
-BestEffort [<SwitchParameter>]
When set to true all errors will be trapped, printed to the terminal bu
t not thrown.
-RunAsync [<SwitchParameter>]
When set to true this command will run asynchronously
-Record [<Get-XenServer:VM>]
The record detailing this Get-XenServer:VM
-NameLabel [<string>]
See SDK Help for full details.
-NameDescription [<string>]
See SDK Help for full details.
-UserVersion [<long>]
See SDK Help for full details.
This get’s you quite a few more parameters to use and points you back to the SDK docs for fuller descriptions. Good stuff? I think so. Here is an example of the same for VMware:
PS C:\> get-help new-vm
NAME
New-VM
SYNOPSIS
Creates a new virtual machine.
SYNTAX
New-VM [-VMHost] <VMHost> -Name <String> [-ResourcePool <ResourcePool>] [-L
Again, truncated like crazy. For the full output, I’ll leave it to you to run the commands.