New WMI Cmdlets with DateTime Support

by Feb 26, 2013

In PowerShell v3, to work with WMI you can still use the old WMI cmdlets like Get-WmiObject. There is a new set of CIM cmdlets, though, that pretty much does the same – but better.

For example, CIM cmdlets return true DateTime objects. WMI cmdlets returned the raw WMI DateTime format. Compare the different results:

PS> Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty LastBoot*
Thursday, January 31, 2013 03:40:26 PM

PS> Get-WmiObject -ClassName Win32_OperatingSystem | Select-Object -ExpandProperty LastBoot*
20130131034026.622639+060

Twitter This Tip! ReTweet this Tip!