Long time ago I watched really interesting training about PowerShell 3.0, it can be found here:
I noticed that sometimes I forget things that were mentioned in there, and lots of my colleagues is not even ware about some of the PowerShell abilities.
It is for sure not about remembering all the stuff, it is about knowing where to find stuff, so do not think there is something wrong with you if you do not remember something:
No you are not! And do not blame yourself every time you forgot that one switch for cmdlet:
So, today’s post is about Get-Help,as it is always good to have crucial / useful information written down – just like Homer Simpson has:
Get-Help / Help / Man – differences
Get-Help is giving you help at one shot, while Help / Man works like “more” or “less” in Linux, it gives you help “page by page”.
-Examples: Gives you only examples for cmdlet:
-Detailed: Returns full information about cmdlet including examples.
-Full: Gives actually very similar output to what -Full returns + detailed description of parameters, telling if a particular parameter is accepting pipeline data as input:
In the above example -ComputerName is accepting input by property name, what does this mean for us? Well, having that we can call his cmdlet like that:
Get-ADComputer -Filter * | Get-Service
If “Accept pipeline input?” on -ComputerName would be set to “false”, we won’t be able to run such command. We would need to use other trick 🙂 but will write about that in second part.
-Online: Redirects us to the online version of help.
-ShowWindow: Shows a help information in a very nice searchable, zoomable format 🙂
Searching for help
If you do not remember exact name of the cmdlet you are looking for, you can try use the wildcard (or star / asterisks) like in this example:
Get-help *service* will return:
Get-Help about* will give us decent list of documents explaining the usage of particular cmdlet:
We can also combine it with -ShowWindow switch.
Get-Help about_aliases -ShowWindow will return:
Get-help for category
It is possible to get help for particular category of cmdlets. To check what are the options you can try to run Get-Help with imaginary -Category parameter value, like “asd”, after running this command I was told what available options were:
“Alias, Cmdlet, Provider, General, FAQ, Glossary, HelpFile, ScriptCommand, Function, Filter, ExternalScript, All, DefaultHelp, Workflow”
Get-Help -Category asd returns:
What is really useful and worth checking out are “about” documents about operators:
Understanding brackets in help
Now a few words about help content itself, so information gathered from it can be actually really useful.
Brackets “[ ]” around parameter mean it is main parameter.
So if we trigger a cmdlet without clearly given attribute but with only a value, that value will be treated as a value for that particular parameter, so in above example “[-Name]” is the main parameter for Get-Service cmdlet.
Also, brackets in “String” means that parameter is accepting multiple values – comma separated. Using that both information this is how we can run this command:
Get-Service bits, w32time
Saving / exporting help locally
It is possible to save help files locally, and later move it to the host that is placed, for example, in perimeter (DMZ) network.
To update help files on a local computer we use:
To update help using previously saved help file we use:
Update-Help -source \\<PATH>