Best Practice: It is recommended to use CIM cmdlets, not WMI cmdlets.
WMI cmdlets are considered obsolete but if you stil use legacy PowerShell v1/2 you could use them.
Since Powershell v3 CIM new cmdlets are available.
WMI (Not recommended)
(Get-WmiObject -ClassName win32_operatingsystem).LastBootUpTime
(Get-CimInstance -ClassName win32_operatingsystem).LastBootUpTime
22 May 2015 09:52:42
Microsoft is not spending time on WMI cmdlets, it means that no additional development or improvement is expected.
However, the positive point of WMI cmdlets is the backwards compatibility with older PowerShell versions.
CIM and WMI use the same WMI backend but the way of communication is different.
- DCOM : used when querying the local computer
- WS-MAN : used for ad hoc connections to remote computer
- DCOM or WS-MAN : used for session-based connections to remote computers
- Session-based connections not supported
- Support only ad hoc connections over DCOM
A great benefit of CIM is the use of WSMAN (WS-Management) protocol for remote access.
Performing queries WMI using RPC/DCOM was not very firewall friendly, it is now easier using WSMAN protocol.
DCOM uses RPC and this protocol requires special firewall exceptions.
Microsoft has implemented the WS-Management standard in Windows Remote Management (WinRM).
Note: CIM tend to return directly the correct Datetime format (no more conversion needed).