Using Select-Object to Explore Objects

When you’re first getting started with PowerShell, you may not be aware that sometimes when you run a command to get data, the information returned to the screen is not ALL the information that the command actually returned.

Let me clarify with an example. If you run the Get-ChildItem cmdlet, you’ll get a bit of information back about all the files in whichever directory you specified.

This is not all the data that got returned, though. There are far more properties than just Mode, LastWriteTime, Length and Name to be examined. What are they? Well, we can pipe this cmdlet into Select-Object -Property * to see them.

Look at all that goodness. You can select specific properties by replacing the star with the names of the properties you want to see.

Happy scripting!

Leave a Reply

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