The first post (this one)gives a short introduction concerning WMI, and show what tools are usefull when working with WMI. The second post covers how to manage WMI namespaces using windows powershell. The third post highlights how we can, create, retrieve delete, and manage WMI classes. The fourth post covers everything you need to know about WMI properties. The fifth post will highlight everything related to WMI qualifiers, and the last and six’th post will explain everything you need the know about WMI Instances.
[stextbox id=”download”]Download the powershell WMI module here ( and Don’t forget to rate it by clicking on the stars ;)).[/stextbox]
Ok, let’s Roll!
Today it is sunday, and the sun is not really shining in lovely Strasbourg/France. It actually raining, but actually I love the rain, so I am feeling GREAT! :D. Nobody is really around in the house anyway, so I guess I can take 10 minutes of your time to give you this short introduction to WMI scripting. I will cover what WMI is, how it is structured, the tools that you will need to work with it, and some good references.
As I mentionned in my very first post (you missed it? check it out here!), I explained that I developed a PowerShell WMI module which I have shared here, that could help to automate WMI / CIM related automation tasks. That is actually why I started the WMI week series, so that I could give the answers to the different questions that came to me regarding the module.
Let’s start our WMI week by explaining briefly what WMI is and why we need to know about it. I will give a very high level of explanation of it, what I think that is sufficient in order to go on and start our WMI trial. If more information is needed on some particular point, go see the references at the bottom of the page.
This is how I will divide this post:
- What is WMI/CIM?
- WMI hierarchy structure
- The different WMI tools.
- The powershell WMI module.
What is WMI / CIM?
This is the WMI definition on wikipedia:
Windows Management Instrumentation (WMI) is a set of extensions to the Windows Driver Model that provides an operating system interface through which instrumented components provide information and notification. WMI is Microsoft‘s implementation of the Web-Based Enterprise Management (WBEM) and Common Information Model (CIM) standards from the Distributed Management Task Force (DMTF).
In other words, it is microsoft implementation of the WBEM and CIM standards on the Windows operating systems.
This is the CIM definition on wikipedia:
The Common Information Model (CIM) is an open standard that defines how managed elements in an IT environment are represented as a common set of objects and relationships between them. This is intended to allow consistent management of these managed elements, independent of their manufacturer or provider.
In other words, this is an open standard that has been established by different vendors and companies in order to allow interoperability between different systems.
[stextbox id=”note”]It is important to be aware of the fact that since Powershell v3, microsoft has taken a turn towards the CIM model.[/stextbox]
I recommend that you check the references part at the bottom of this post if you need more details.
The structure of WMI is logic and hierachycal.
WMI hierarchy structure:
The WMI structure is logic and hierarchical. If we simplify it to a minimum, WMI infrastructure could be sum up as followed: A WMI provider, followed by namespaces, which will hold classes, which will in their turn contain properties and eventually methods. To make it more understandable I tried to draw a basic version of the WMI structure. I tried to put collors in the schema to make it more understandable. On the left side you will see the names, and on the right concrete examples (here i took Cimv2 – win32_share and win32_bios as an exmple)
- In red you will find the namespaces
- In green the classes
- In blue the properties
- In yellow the methods
[stextbox id=”note”]This hierarchy concept is verry difficult to understand if you limit your self only to the powershell prompt. Various tools exist on the market that help you have a clearer view of the WMI repository and it’s content.[/stextbox]
I recommend that you download and try one of the tools below, it will become very handy if you are planning to work with WMI / CIM.
The WMI and CIM infrastructure can be pretty difficult to understand. Especially if you where going through only using powershell or even VBS. But, in our days, there exists a number of tools that help us work and understand the WMI / CIM infrastructure on windows operating system much much easier. A lot of them have been explained already by the older gods of powershell already. So for these ones, I will not re-invent the wheel since these are excellent articles.
You will need to have a WMI explorer to make things clearer. A tool with a GUI will allow you to understand the logic behind the structure. It will help you visualize the the structure of it. There are a few tools that you can find on the internet. Some of them are free, others are not. But I recommend you go and download one of them. It will make things a lot easier. Also for some of the tools, I recommend you to read the posts of jeffrey hicks. his articles at 4sysops give a good overview of the different products.
Sapien WMI explorer:
I have to say, I really love this tool. If you need to see what is currently present in your WMI repository, you will have not be able to find a better friend then WMI explorer 2014 from Sapien. Fast, clean and reliable, this tool is defenitley worth the money! WMI explorer 2014 from Sapien.
Jeffery Hicks article –> https://4sysops.com/archives/free-sapien-technologies-wmi-explorer/
Coretech WMI browser:
The Coretech WMI browser has been written by PowerShell MVP Kaido Järvemets. This would be my second recommendation after the sapien one. Having this one available as a freeware, make it even more cooler 🙂
Coretech’s website tutorial and download link–> http://blog.coretech.dk/kaj/coretech-wmi-and-powershell-browser/
MOW WMI browser:
This tool is great, it is free, and gives you easy access and view to your WMI repository.It is sometimes slow and throws some errors on some specefic actions. I still think these errors are really rare, and this would be the best alternative to Sapien WMI explorer if you can’t afford it.
Jeffery Hicks article –> https://4sysops.com/archives/free-mow-powershell-wmi-browser/
WMI administrative tools:
The microsoft WMI administrative tools are some old tools that had been developped in the late days of Windows 2003 Server.(or even earlier ?o_O). It is also a graphical interface that allows you to see the WMI repository. This tools is mainly based on HTTP, and work pretty difficultly with newer OS versions like windows 8 and windows 8.1.
Microsoft WMI administrative Tools direct download –> http://www.microsoft.com/en-us/download/details.aspx?id=24045
Jeffery Hicks article –> https://4sysops.com/archives/free-wmi-administrative-tools-wmi-object-browser-and-wmi-cim-studio/
Is a utility tool that is present on ever computer where WMI is installed. It’s interface makes it difficult to start working with, but it can turn out to be an incredible usefull ally if you need to work directly on WMI. It let’s you create WMI classes, namespaces, properties etc.. but it will not let you explorer it.
Microsoft help page –> http://msdn.microsoft.com/en-us/library/cc785775(v=ws.10).aspx
Jeffery Hicks article –> https://4sysops.com/archives/wbemtest-part-1-testing-wmi-connectivity/
This great tool will help you create basic powershell queries in order to retrieve information from you WMI repository.
Microsoft instructions page –> http://technet.microsoft.com/en-us/library/ff730935.aspx
[important]This is just a short list. and probably more could be found on the internet (don’t hesitate to share them with us). [/important]
Powershell WMI module 2.0:
Now accessing the WMI explorer infrastucture is good. Having the graphical interface to see the repository is great. We can retrieve property information, count the number of instances easily with the integrated cmdlets of powershell.BUT, how can we create our own classes ? How do we create our own properties, with corporate specefic information? How do you tatoo you windows image using powershell with information such as monitor information, or how long the windows image build has taken? How can we script and write information directly in the WMI repository that can later be used for statistics through reports in configmgr? All of this can be done using the PowerShell wmi module.
I have developped this module originally because I needed to tatoo information in the WMI repository during the operating system build. I noticed that in 2014, I still needed to use VBS for some tasks, WMI property creation is one of them. Since I am Powershell nerd,I decided to create the powershell WMI module.
This whole series intiled the WMI week will cover how to create, delete, manage WMI namespaces, classes, properties, instances, qualifiers with powershell. All of this will be done using the Powershell WMI module.
[important]The PowerShell WMI module can be downloaded here–> link[/important]
Ok, that is it for today folks! Tomorrow we will dive directly deep into action and start with managing WMI namespaces using windows Powershell.
How to troubleshoot WMI errors –> here
WMI on wikipedia –> http://en.wikipedia.org/wiki/Windows_Management_Instrumentation
CIM on wikipedia –> http://en.wikipedia.org/wiki/Common_Information_Model_(computing)[/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]