≡ Menu

PowerShell: Get Windows System Info in Object format

I came across a tip in twitter from Jeffry Snover that helps in converting the System Information from Windows System information into PowerShell object. This conversion helps in easily accessing the information just by accessing the Property values.

Look at below example for better understanding.

$Obj = systeminfo /FO CSV | ConvertFrom-CSV            
$Obj.'System Boot Time'            
$Obj.'System Type'            

The first line queries the System information from local computer and stores the value in $Obj after converting the output from CSV to Object format. Once the results are available in $Obj you can review the properties of this object and query the data you want. All you see in $Obj is same as what you see when systeminfo command is ran. It’s just that formatting the output and storing in object structure for better processing.

SystemInfo-Powershell

Here is the original tweet I am referring to.

Hope this tiny tip helps.

Comments on this entry are closed.

  • Krushna January 20, 2015, 12:45 pm

    Thank U