This being a new year and not posting in over a year I decided to create a habit of writing once a week about PowerShell, or another technology topic. I have also decided that I am going to focus completely on technology, staying away for all other topics, including family.
Let me state that I am in no way an expert in PowerShell, in fact I’m far from it so I’m learning as you are learning while I write this. I’m doing what Don Jones has talked about in “Be the Master” which is you can be the master by giving back, by writing what you are learning to help other people.
With that, let’s move to the beginning of PowerShell and the best way to learn about cmdlets and how to use them. In fact it’s a cmdlet thats built into PowerShell called “get-help”. That’s easy isn’t it? Well yes, it is, but it is very multifunctional, has many different options, and at times confusing. In this post I’m just going to start with the first basic usage and in the next few posts go into detail. Get-Help in its most basic form without any parameters looks like this using the “get-service” cmdlet:
PS C:\Powershell> get-help get-service
Gets the services on a local or remote computer.
Get-Service [-ComputerName ] [-DependentServices] -DisplayName [-Exclude ] [-Include ]
Get-Service [-ComputerName ] [-DependentServices] [-Exclude ] [-Include ] [-InputObject
] [-RequiredServices] 
Get-Service [[-Name] ] [-ComputerName ] [-DependentServices] [-Exclude ] [-Include ]
The Get-Service cmdlet gets objects that represent the services on a local computer or on a remote computer, including running
and stopped services.
You can direct this cmdlet to get only particular services by specifying the service name or display name of the services, or
you can pipe service objects to this cmdlet.
Online Version: http://go.microsoft.com/fwlink/?LinkId=821593
To see the examples, type: “get-help Get-Service -examples”.
For more information, type: “get-help Get-Service -detailed”.
For technical information, type: “get-help Get-Service -full”.
For online help, type: “get-help Get-Service -online”
This give you the basics:
- The Name
- The Synopsis
- The Syntax
- The Description
- Related Links
I’m only going to go over the Name, Synopsis and the Remarks in this discussion, with the others in later posts. Let’s start with the obvious “Name”, which is the name of the cmdlet we are getting help on which in this case is “get-service”. Next up is the “Synopsis” which is a brief description of the cmdlet, in this instance get-service “Gets the services on a local or remote computer”. These two are self-explanatory, really not needing any further discussions.
The last part of Get-help that I want to touch on is the “Remarks” because this is a great source of help before you understand the syntax of the cmdlet. By typing a parameter at the end of your get-help cmdlet you can see examples, a detailed view, a full view which is detailed with the addition of input and output object types, and additional notes, and finally the online view which will take you to the docs.microsoft.com page for the cmdlet.
I said finally when I was talking about the online parameter which really isn’t the last way to view help for a cmdlet. The “Show Window” parameter will open a separate window that you can scroll through the help for that cmdlet. It looks like the picture below. I prefer “get-help get-service -ShowWindow” because I get everything in a separate window that I can leave open, and don’t lose anything to the buffer of the PowerShell Window. It also lets me continue to try the cmdlet in various iterations while switching to the window to see the help by itself. Less clutter, easier for myself to work with. You may prefer another parameter like Examples which I use when I really understand the cmdlet, but just want a refresher on the common uses.
That’s the beginning of Get-Help. My next post will start to go into the Description and the Syntax of Get-Help. Let me know in the comments if you have any questions, constructive ideas or tips of your own.