One of the neatest tricks I've come across recently has to do with a need I find I have frequently: to be able to see the full structure of my output. Sure, I can use Get-Member, but I'll only see the top level of the object, and won't see what's actually in each property. I could also use Select-Object *, but that, too, is only going to show me the top level, and only what each part comes out to when converted to a string (frequently with no indication that they are more complex objects, and not just strings).
So, how do I go about tearing output down so I can see everything? Well, I could use Export-CliXml and look at the file it puts out. I could also use ConvertTo-XML, but XML is not the easiest to work with in PowerShell (powerful, but not easy).
PowerShell has the perfect tool for this built right in: ConvertTo-JSON.
To demonstrate, here is the output of Get-Service winrm | Select *:
Name: winrm
RequiredServices: {RPCSS, HTTP}
CanPauseAndContinue : False
CanShutdown : True
CanStop : True
DisplayName : Windows Remote Management (WS-Management)
DependentServices : {}
MachineName : .
ServiceName : winrm
ServicesDependedOn: {RPCSS, HTTP}
ServiceHandle :
Status: Running
ServiceType : Win32OwnProcess, Win32ShareProcess
StartType : Automatic
Site:
Container :
While this tells us a lot about what the service object has available, it doesn't really show everything. In this instance, you can see pretty well that RequiredServices, DependentServices, and ServicesDependedOn all contain (or can contain) multiple other objects and objects that are more complex than a simple string or int. As I mentioned before, though, this is not always so easy to see: single complex objects will typically just show you whatever their string representation is, and you have to either check them manually or look through the output of Get-Member to see what's going on. If you don't know what you're looking for, this can be tedious.
Here is the same service passed instead to ConvertTo-JSON:
This gives a lot more detail, and if you're looking for something in particular, it would be easy at this point to do a text based search on the output.
One downside to this method is that you do not see any type information for any of the output. For that, once you find the properties you're looking for, you'll still need to manually check that if you need to know what you can use it for.
ConvertTo-JSON may not have been meant for this, but it has helped me personally in many situations to find what I'm looking for much faster. I hope it helps you as well!
(Just as a quick aside for those curious, JSON is "JavaScript Object Notation", and as the name implies, it is used by JavaScript to represent objects. There are lots of REST APIs available on the Internet which present information as JSON, and both ConvertTo-JSON and ConvertFrom-JSON are useful for interacting with these in PowerShell.)
Update 2018-01-08: Just adding a note that there are times when ConvertTo-JSON won't fully display some properties and instead will just convert the object contained to their default string, which in the case of too many object types turns out to be the name of the object itself. So, you might find something you're looking into has some properties set to something like "System.Object" or "System.Object[]" (if they're generic objects). When you run into these, you'll have to resort to manually examining those (though you could probably just pass those objects to ConvertTo-JSON to dig deeper).