Read-WmiObjectCount
Read-WmiObjectCount
Store the number of instances of a class found in a variable.
Settings:
- Namespace
Specifies the namespace to which the connection is to be made and in which the class (object) is located. This value is also set using the WMI browser. The default namespace is \\.\root\CIMV2. - Object path
This is the relative path within the namespace and corresponds to the class name for which the number of existing instances on the system is to be determined. This value is also set using the WMI browser. - Variable name
Name of the variable in which the result - i.e. the number of instances found of the class being searched for - is stored. Enter only the name of the variable, not the $ sign and the curly brackets.
Example:
In the following example, the number of drives corresponding to the number of instances of the class Win32_DiskDrive is read and stored in the variable _DriveCount:
Corresponds to DSM eScript command:
- WMIGetInstanceCount
See also: