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.
Here is the original tweet I am referring to.
Great PowerShell Tip from Dr Tobias Weltner: SystemInfo.exe /FO CSV | ConvertFrom-CSV
— jsnover (@jsnover) September 29, 2014
Hope this tiny tip helps.
Comments on this entry are closed.
Thank U