In PowerShell, most data are represented as PSObjects, a specific object “wrapper” added by PowerShell. To get to this specific wrapper, objects have a secret property called “PSObject”. Let’s take a look:
# get any object $object = Get-Process -Id $pid # try and access the PSObject $object.PSObject # get another object $object = "Hello" # try again $object.PSObject
As you’ll see, the secret “PSObject” is basically a description for the object. And there is a ton of useful information embedded. Here’s some:
# get any object $object = Get-Process -Id $pid # try and access the PSObject $object.PSObject # find useful information $object.PSObject.TypeNames | Out-GridView -Title Type $object.PSObject.Properties | Out-GridView -Title Properties $object.PSObject.Methods | Out-GridView -Title Methods