PowerShell: Get-Command and Get-Member

Black and White PDQ logo
Kris Powell|September 11, 2014
PowerShell: Get-Command and Get-Member
PowerShell: Get-Command and Get-Member
Sections
    No Data

    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:

    get command

    Get-Command

    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.

    get command select object name

    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.

    get command get member

    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.

    get command select object commandtype 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.

    Did you know that PDQ Deploy has a PowerShell step you can use to deploy your scripts?

    Black and White PDQ logo
    Kris Powell

    Kris was an employee at PDQ.

    Related articles