An email debate yesterday regarding the use of the CIM cmdlets (new in PowerShell 3) vs the WMI cmdlets made me realise that other people are probably wondering the same thing,

The question is really part of a the semi-philosophical debate about when you should adopt new technology.

In the case of the WMI/CIM cmdlets the resolution is fairly straightforward.

If you are using PowerShell v2 you have to use the WMI cmdlets.

If you are using PowerShell v3 – even if you are accessing legacy systems I would recommend the CIM cmdlets.  There are a number of benefits to using the CIM cmdlets:

  • use of WSMAN for remote access – no more DCOM error. You can drop back to DCOM for accessing systems with WSMAN 2 installed
  • use of CIM sessions for accessing multiple machines
  • Get-CIMClass for investigating WMI classes
  • improved way of dealing with WMI associations

As far as I am aware the only thing the CIM cmdlets can’t do is access amended qualifiers such as the class description. Seeing that many classes don’t that set it’s not a major hardship.

Now that I’ve recommended you should use them I’d better show you how – that will cover a mini-series of posts over the next few days

This entry was posted in PowerShell and WMI, PowerShell V3. Bookmark the permalink.

2 Responses to WMI vs CIM

  1. mjolinor says:

    While working on a poster’s problem with WMI on the technet forums, I found that a WMI object returned from a background job is useless as far as being able to use any of the methods (they get stripped off during serialization, and would suffer the same if returned from a remote session).

    A CIM instance can be passed from a background job (or remote session) and then used to invoke methods by piping it into Invoke-CimMethod. The CIM instance never had any instance methods to start with, so nothing is expecting them to be there and consequently nothing gets broken

  2. Joel says:

    Hi, Richard,

    It was great meeting you at the ’14 PS NA Summit. Thanks again for all your work in organizing it. The Summit was my first opportunity to learn about CIM, and I’m glad I did. I’ve turned my 1&1/2 hour network inventory into a 15-minute process, largely thanks to CIM and some architecture ideas from Jim Christopher.

    However, it seems like the knowledge that computers running PS3 can successfully query PS2 computers via CIM is not (yet) public knowledge. As I discovered at the conference, it isn’t necessary to drop back to DCOM if a property parameter is included or if a query is used (see
    http://powershell.org/wp/forums/topic/using-cim-to-get-data-from-computers-running-powershell-2/) Since I don’t have a PS blog of my own (yet…) I’m just trying to get the word out, to help those of us who still have a lot of PS2 computers in their environment.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s