CIM – Taking the leap

If you use PowerShell regularly, chances are that you have used WMI. Microsoft introduced a new set of cmdlets in PowerShell version 3, the CIM cmdlets, which is meant as the new and improved way of interacting with WMI/CIM.

But I know from personal experience that it takes times to learn something new, and when the old way works, why bother right?

After reading this blog post from Richard Siddaway, I took the leap and converted one of my old functions that uses WMI, to use the new CIM cmdlets, and in the process I created a template for creating functions that uses CIM to query computer(s) for information. I’m sharing it here in hope that others might take the leap as well, and hopefuly you will find this template useful.

The function in the template will try to connect to a computer using WSMAN first, but fall back to DCOM if that fails. This way you can still use it against legacy systems as well.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s