Working with WMI
The scope of WMI is vast, which makes it a fantastic resource for automating processes. WMI classes are not limited to the core operating system; it is not uncommon to find classes created after software or device drivers have been installed.
Given the scope of WMI, finding an appropriate class can be difficult. PowerShell itself is well equipped to explore the available classes.
WMI classes
PowerShell, as a shell for working with objects, presents WMI classes in a similar manner to .NET classes or any other object. There are several parallels between WMI classes and .NET classes.
A WMI class is used as the recipe to create an instance of a WMI object. The WMI class defines properties and methods. The WMI class Win32_Process
is used to gather information about running processes in a similar manner to the Get-Process
command.
The Win32_Process
class has properties such as ProcessId
, Name
, and CommandLine
. It has a terminate
method that can be used...