Using Get-Member to Explore Objects

Last week, I put out a post about using Select-Object to explore PowerShell objects. This week, I am going to quickly cover using Get-Member to do the same.

Let’s say you’re using Get-CimInstance to get information about the operating system. You might do something like this.

As is the case with our example last week, there’s more stuff returned and available to us than what is returned by default. Let’s use Get-Member to see what it all is.

Holy smokes, there’s a lot of stuff there. As with Select-Object, you can see all the different properties that exist in this object. The big difference here is that you can see all the different methods this object comes with, too. You could store this information in a variable and then invoke the .HashCode() on it and see the output of that, like this.

There’s a lot of examples of methods that are more interesting than this, but you can play with it and make this work for you.


0 thoughts on “Using Get-Member to Explore Objects

Leave a Reply

Your email address will not be published. Required fields are marked *