Return discovered inventory

Just playing around today and thought I’d make this little post on how to return discovered inventory in Command Shell.  This one in particular will return all disk sizes discovered, convert to GB and round to the nearest 1.

get-MonitoringClass | where {$_.Name -like "Microsoft.Windows.Server.200?.LogicalDisk"} | get-MonitoringObject | get-MonitoringObjectProperty | Where {$_.Name -eq "SizeNumeric"} | Select @{Name="GB";Expression={[Math]::Round($_.Value / 1024, 0)}}

 

This is what I call fun!

 

Command Shell Reference