Accessing Object Properties

by Jun 8, 2010

Objects store information in various properties. There are two approaches if you would like to get to the content of a given property. One is commonly used among developers, the other one among admins. Both will get you the same result. Have a look:

# access PowerShell
$process = Get-Process -id $pid
# output entire object
# read CPU usage only (developer version)
# read CPU usage only (pipeline version)
$process | Select-Object -expandProperty CPU

Twitter This Tip! ReTweet this Tip!