CIM vs. WMI CmdLets – Speed comparison

In one of my last posts I mentioned that for me the CIM CmdLets have been faster than the WMI CmdLets. I referred mainly to my personal impression working with these CmdLets for quite some time on a pretty large array of different servers and tasks and supported this statement only with some pretty basic test.

So I was interested in comparing different aspects of this and did some more testing. This is for sure not a complete performance evaluation. It’s more meant to get some numbers on this in different situations, and give me (and hopefully you as well) a guideline on when it might make sense to choose one or another.

The Test Setup

I executed all tests using the following snippet to measure the execution time:

The different test that I ran on each of the computers were:

  • Querying a single WMI class (Win32_ComputerSystem)
  • Querying multiple WMI classes (Win32_ComputerSystem, Win32_OperatingSystem, Win32_Bios)
  • Listing all WMI classes (using Get-WMIObject -List and Get-CimClass)

Each of this test had been executed using:

  • WMI CmdLets
  • CIM CmdLets
  • CIM CmdLets with dedicated DCOM based session(s)
  • CIM Cmdlets with dedicated WSMAN based session(s)

All of them had been executed 100 times (10 times on listing the WMI classes) and the minimum, average and maximum execution time in milliseconds has been exported to a csv file. Also all the tests had been executed on two different computers, targeting different sets of computers.

1. Working with a single computer

First scenario is working on one single computer. That’s probably the most common scenario. A special case is the local computer. So I did all of my testing on the local computer first, then a few computers on the same, local network and then a few computers on a remote network over a WAN connection.


Localhost was pretty much as expected. A single execution of Get-WmiObject was ~2.5-3 times faster than Get-CimInstance. Mostly due to that it has to create an implicit session first. If a session object is supplied, access is faster, as anticipated. However interesting here is, that Get-CimInstance using WSMAN is almost the same speed (~15% faster) with an explicit session as Get-WmiObject, but using DCOM is about twice as fast on a single class.

WMI/CIM Speed Test - Localhost

Listing all classes was definitely different than expected. Get-CimClass is almost 3.5 times slower than Get-WmiObject -List. No matter if using no session or the WSMAN session (CIM CmdLets will use an implicit WSMAN session on default), while in opposite using a DCOM based session was more than 3.5 times faster than the WMI CmdLet.

WMI/CIM Speed Test - Localhost

Local Network

To validate the above numbers, I had a look on the average of several computers on the local network. The numbers look similar, but the performance difference isn’t that large anymore. Get-WmiObject is „only“ ~1.5 times faster when querying a single class, but using Get-CimInstance with a DCOM session is still about 3.5 times faster than this. Also WSMAN is more performant over the network as it was on the local computer

WMI/CIM Speed Test - Local Network

However, when listing the classes, Get-CimClass using a WSMAN based session was pretty slow again. Not as bad as on the local computer, but still about 30% slower than the WMI CmdLet.

WMI/CIM Speed Test - Local Network

I was curious if that’s a problem specific to Get-CimClass. So I executed a query that returned a pretty large amount of objects. In particular the Event log returning about 30-60K events on the computers that were used for testing. And it’s pretty similar. The WMI CmdLet was about 60% slower than the CIM CmdLet, but again there isn’t much difference between running Get-CimInstance without a session or with a WSMAN session. However using a DCOM based session was twice as fast than using the WSMAN based session.

WMI/CIM Speed Test - Local Network

Fast WAN connection

Next round of tests was on computers on a relatively fast WAN connection (~20-60 ms response time). And here the WMI CmdLets really lost their ground. Even without a session, the Cim CmdLets where about 4 times faster up to 21 times faster using a WSMAN session.

WMI/CIM Speed Test - Fast WAN

Pretty much the same when listing the classes, just the WSMAN session was slightly slow(er) again.

WMI/CIM Speed Test - Fast WAN

Slow WAN Connection

The last round of tests were executed against computers on a relatively slow WAN connection (~150-250 ms response time). While the total time was definitely different, the relative performance difference between the test was similar to the ones on the fast WAN connection. So not much to add here.

WMI/CIM Speed Test - Slow WAN

WMI/CIM Speed Test - Slow WAN

2. Working on multiple computers

The second scenario is working with multiple computers. For this the above described tests had been executed again, but this time not indivdiually in a loop per computer, rather passing in the list of computers (or sessions) to the WMI and CIM CmdLets. This allowed them to handle the degree of parallelization internally.

And here the CIM CmdLets could really shine. While the WMI CmdLets still executed each query individually and so the total time of execution was more or less the sum of the individual tests from above, it’s really obvious, that they are getting executed in parallel by the CIM CmdLets. The total time on them was always close to the slowest average execution time on the individual tests.

WMI/CIM Speed Test - Multiple Computers - Query

WMI/CIM Speed Test - Multiple Computers - List Classes


I have to say that those tests were pretty interesting. While this is definitely not a all-purpose, covering-everything type of test and your results might look different, I still think that it gives a pretty good indication on the performance aspect of both the WMI CmdLets and the CIM CmdLets.

My personal conclusion from those tests:

  • If you are targetting multiple computers, always use the CIM Cmdlets! Really!!!
  • Preferably use dedicated sessions when working with the CIM CmdLets.
  • If you are looking on the last grain of speed and are working on a relatively fast connection, prefer DCOM over WSMAN.
  • When working mainly on slow connections with large response times, you should prefer WSMAN.

However, this is just the „performance“ side of things. For a final decision, lots of other aspects have to be taken into account as well.


I’d be happy to hear about your experience with this topic.

Das könnte Dich auch interessieren...

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.