What to know about Get-Command and Get-Member cmndlets in PowerShell
Today, I want to show you a couple great cmdlets that can really strengthen your understanding of PowerShell: Get-Command and Get-Member.
Get-Command will list all commands that are installed on the computer, including cmdlets, aliases, functions, etc.
Try it out. The results should look something like this:
There’s a lot of output on the screen, so we can clean this up a little bit to make it easier to read.
Let’s say we just want the name of the commands. We’re going to select only one object property by piping the results of Get-Command and selecting the property that we want to see.
But, how do we know which object properties exist to select and sort? We’re going to introduce another command today called Get-Member.
Get-Member tells us about the Properties and Methods of an object.
The easiest way to use it is to pipe in an object that you want to know more about.
We can see that there are many properties for Get-Command that we can use to sort and view. Let’s use CommandType and Name.
You should be able to look at that list and find any cmdlet that’s installed that you can use.
In the next blog, we will go over another tool that will help get more detailed information about each cmdlet from within PowerShell itself.
In the meantime, here’s some more detailed information about Get-Command and Get-Member.
Kris was an employee at PDQ.