PowerShell – Sub-Expressions

My thoughts on using sub-expressions to access object properties.

$serviceObj = Get-Service "wmi*"
Write-Output "Service Status $serviceObj.status"

Service Status System.ServiceProcess.ServiceController.status
Not really the output I was expecting.  This is where the sub-expression comes in handy!  I can use a sub-expression to extract the status property value and display without using another variable.
$serviceObj = Get-Service "wmi*"
Write-Output "Service Status $($serviceObj.status)"

Service Status Stopped
aplusd