Showing posts with label vbscript. Show all posts
Showing posts with label vbscript. Show all posts

Wednesday, 24 September 2025

About WMI Code Creator.

Hi all.

WMI Code Creator is a magic wand for system administrators. But what's interesting is that the name is 100% accurate. It's also true that half of system administrators have never heard of this wonderful tool, and the other half who have heard of it don't use it yet.

WMI Code Creator is a tiny (300KB) Microsoft tool available here. To demonstrate its features, the code snippet below is for querying a machine’s model and gives us enough info to start using the tool.

strComputer = "."

Set WshShell = WScript.CreateObject("WScript.Shell")

strQuery="SELECT * from Win32_ComputerSystem"

Set col=GetObject("WinMgmts://" & strComputer & "/root/cimv2").ExecQuery(strQuery)

For Each WMIProperty in col

PCModel = WMIProperty.Model

First, I need to select the CIMV2 namespace and then find the win32_computersystem class in the class drop-down box. Without reference to a huge book or the internet, you would struggle to discover the properties in the class without perhaps writing a script. Code creator makes this trivial, with the click of a single button which lists all properties. The model is just one property of many, as you can see in figure below:


Версия на печать

Популярное