In this article, we shall discuss Windows Management Instrumentation Commands. Windows Management Instrumentation (WMI) is the Microsoft implementation of Web-Based Enterprise Management (WBEM), which is an industry initiative to develop a standard technology for accessing management information in an enterprise environment. Please see how to Get a list of installed programs locally or remotely in Windows, how to query a list of installed programs in Windows, and how to Remote WMI Connection: How to enable or disable WMI Traffic Using Firewall UI.
WMI is part of Windows since Windows 2000. It is a service that can query almost every detail about a computer system. PowerShell ships with full WMI support.
Common Information Model) cmdlets
These are the most important CIM (Common Information Model) cmdlets and are fully supported by PowerShell.
|Cmdlets used in PowerShell||Description|
Gets instances of WMI classes. This is the most important cmdlet
|Get-CimClass||Gets a WMI class. Use it to access static WMI methods.|
|Invoke-CimMethod||Runs a WMI method, and returns results.|
|Set-CimInstance||Writes back changed properties.|
|New-CimSession||Creates a new remoting session to one or more remote systems|
|New-CimSessionOption||Defines special options for remoting connections.|
|Remove-CimSession||Closes and removes a remoting session that is no longer used.|
|New-CimInstance||Creates a new instances of a WMI class, i.e. for temporary use.|
WMI Commands – How to query information using WMI (Get-CimInstance)
To get information from WMI, you ask for instances of a given class. The PowerShell code for this is always the same, so the hardest part in WMI is to figure out the name of the class that describes what you are after.
Get-CimInstance -ClassName Win32_BIOS
Get-CimInstance <And enter the class name at the prompt> Win32_BIOS
2. DISK – list logical disk information
Get-CimInstance -ClassName Win32_LogicalDisk
Get-CimInstance <And enter the class name at the prompt> Win32_LWin32_LogicalDisk
The WMI namespace root/cimv2 is the default namespace and contains classes for computer hardware and configuration.
root/cimv2 contains the following 276 classes:
The namespace root/cimv2 contains many more classes that may serve internal purposes (link classes to define relationships, abstract classes that serve as a template for inherited classes, etc. Take a look at the other class types.
I hope you found this blog post helpful on Windows Management Instrumentation Commands. If you have any questions, please let me know in the comment session.