Prof. Powershell

Member(ship) Has Its Privileges

The Get-member cmdlet tells you everything you need to know about an object's properties and methods.

A terrific Windows PowerShell feature is its ability to tell you about itself. It's sort of like speed dating. Because PowerShell is an object-based shell, it is important that you understand an object's properties and methods. In the VBScript days, you would have had to rely on MSDN documentation, books and the kindness of strangers.

The PowerShell world is different. We can use the Get-Member cmdlet (which has an alias of gm) to tell us everything we ever want to know about an object.

When you run Get-Process, you see a pre-defined set of properties for a process object. But there are more. Open a PowerShell prompt and try this:

Get-process | get -member

You should get a long listing. Look at all those properties. In addition to the property name, you can see what type of property it is and whether it can be changed. Any property where you see {set} indicates it can be changed. It may take one of the methods you see listed to make the change, but it is an adjustable property. For the most part, you'll be happy to know what other properties are available. Why? So you can take advantage of the pipeline. Look at this expression:

get-process | format-table ID,Name,StartTime,Path -auto

Still the same process objects, but because we discovered some additional properties, we can ask PowerShell to display them.

You can use Get-Member as a great troubleshooting tool as well. Whenever I have a long PowerShell expression and I'm not getting the result I expect, I pipe the expression to Get-Member so I can verify what type of object is in the pipeline.

If you have variables, you can also pipe them to Get-Member to learn their type, properties and methods. You can pipe just about anything in PowerShell to Get-Member and to discover more. If you run into a property you don't understand, then you will need to turn to something like the MSDN documentation to learn the details. Or post something in the forums at

To learn even more about this valuable cmdlet type:

Help get-member -full

About the Author

Jeffery Hicks is an IT veteran with over 25 years of experience, much of it spent as an IT infrastructure consultant specializing in Microsoft server technologies with an emphasis in automation and efficiency. He is a multi-year recipient of the Microsoft MVP Award in Windows PowerShell. He works today as an independent author, trainer and consultant. Jeff has written for numerous online sites and print publications, is a contributing editor at, and a frequent speaker at technology conferences and user groups.

comments powered by Disqus
Most   Popular