WMI Type Accelerators
The WMI cmdlets were removed in PowerShell 6 and are not going to be reinstated.
The following type accelerators remain and can still be used:
Wmi
:System.Management.ManagementObject
WmiClass
:System.Management.ManagementClass
WmiSearcher
:System.Management.ManagementObjectSearcher
When necessary, these accelerators may be used to simulate the functionality provided by the older WMI cmdlets.
Both the Wmi
and WmiClass
type accelerators can be written to use a remote computer by including the computer name. An example is as follows:
[Wmi]"\\RemoteComputer\root\cimv2:Win32_Process.Handle=$PID"
[WmiClass]"\\RemoteComputer\root\cimv2:Win32_Process"
You can use these classes in PowerShell 6 and higher.
Getting instances
You can use the type accelerator WmiSearcher
to execute queries and retrieve results:
([WmiSearcher]"SELECT * FROM Win32_Process").Get()
The returned...