PowerShell for Windows Admins

Jun 6 2011   1:57PM GMT

Get-WmiObject property parameter



Posted by: Richard Siddaway
Tags:
PowerShell v2

This is a fairly obvious piece of PowerShell

Get-WmiObject Win32_Volume

We would probably restrict the properties we displayed like this

Get-WmiObject Win32_Volume | select DriveLetter, DriveType, Freespace

or possibly

Get-WmiObject Win32_Volume |
format-table DriveLetter, DriveType, Freespace –AutoSize

If we are dealing with a large number of remote machines we may want to restrict the properties we return – this is where we use the –property parameter

Get-WmiObject Win32_Volume -property @("DriveLetter", "DriveType", "Freespace")

NOTE THIS STILL RETURNS THE SYSTEM PROPERTIES

so to get a good display we would want to still use format-table (or select)

Get-WmiObject Win32_Volume -property @("DriveLetter", "DriveType", "Freespace") |
format-table DriveLetter, DriveType, Freespace –AutoSize

The –property parameter gives us another opportunity to restrict the data returned to reduce network traffic but we still need to format the returned data

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: