Main example
List instances
# All instances of Win32_WMISetting, with the main properties
Get-CimInstance -ClassName Win32_WMISetting |
Select-Object -Property @(
'Caption'
'Description'
'ASPScriptDefaultNamespace'
'ASPScriptEnabled'
)Singleton class: only one instance exists.
Examples
Filter with WQL
# WQL filter evaluated by the provider: AutoStartWin9X = 0 (Don't start)
Get-CimInstance -ClassName Win32_WMISetting -Filter 'AutoStartWin9X = 0' |
Select-Object -Property @(
'Caption'
'Description'
'ASPScriptDefaultNamespace'
'ASPScriptEnabled'
)The filter is evaluated by the WMI provider: less data is transferred than with Where-Object.
Decode numeric values
# Lookup table for AutoStartWin9X (values documented by Microsoft)
$autoStartWin9XName = @{
0 = 'Don''t start'
1 = 'Autostart'
2 = 'Start on reboot'
}
# Lookup table for LoggingLevel (values documented by Microsoft)
$loggingLevelName = @{
0 = 'Off'
1 = 'Error logging'
2 = 'Verbose Error logging'
}
Get-CimInstance -ClassName Win32_WMISetting |
Select-Object -Property @(
'Caption'
'Description'
'ASPScriptDefaultNamespace'
'ASPScriptEnabled'
@{ Name = 'AutoStartWin9X'; Expression = { $autoStartWin9XName[[int]$_.AutoStartWin9X] } }
@{ Name = 'LoggingLevel'; Expression = { $loggingLevelName[[int]$_.LoggingLevel] } }
)Query a remote computer (CIM session)
review before running# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
Get-CimInstance -CimSession $cimSession -ClassName Win32_WMISetting |
Select-Object -Property @(
'Caption'
'Description'
'ASPScriptDefaultNamespace'
'ASPScriptEnabled'
)
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_WMISetting
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ASPScriptDefaultNamespace# | string | read/write | Default script namespace. This property contains the namespace used by calls from the Scripting API for WMI if none is specified by the caller. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\ scripting|Default Namespace Example: root\cimv2 For an example script that uses this property, see the Remarks section. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| ASPScriptEnabled# | boolean | read/write | If True, WMI scripting can be used on Active Server Pages (ASP). This property is valid on systems running unsupported versions of Windows only. For supported Windows systems, WMI scripting is always allowed on ASP. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| AutorecoverMofs# | string[] | read | List of fully qualified MOF file names used to initialize or recover the WMI repository. The list determines the order in which MOF files are compiled. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\ CIMOM|Autorecover MOFs Code | ||||||||||||
| AutoStartWin9X# | uint32 | read/write | Not supported. Values (3)
CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| BackupInterval# | uint32 | read/write | Not supported. Instead, backup the WMI repository manually. Unit: minutes CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| BackupLastTime# | datetime | read/write | Date and time the last backup was performed. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| BuildVersion# | string | read | Version information for the currently installed WMI service. Length of time that elapses between backups of the WMI database. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|Build Code | ||||||||||||
| Caption# | string | read | Short textual description of the current object. Code | ||||||||||||
| DatabaseDirectory# | string | read | Directory path that contains the WMI repository. Code | ||||||||||||
| DatabaseMaxSize# | uint32 | read | Maximum size of the WMI repository. Unit: kilobytes Code | ||||||||||||
| Description# | string | read | Textual description of the current object. Code | ||||||||||||
| EnableAnonWin9xConnections# | boolean | read/write | Not supported. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| EnableEvents# | boolean | read/write | If True, the WMI event subsystem should be enabled. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|CIMOM|EnableEvents CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| EnableStartupHeapPreallocation# | boolean | read/write | If True, WMI creates a pre-allocated heap with the size of the LastStartupHeapPreallocation value when WMI is initialized. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| HighThresholdOnClientObjects# | uint32 | read/write | Maximum rate at which provider-created objects can be delivered to clients. To accommodate speed differentials between providers and clients, WMI holds objects in queues before delivering them to consumers. For more efficiency, consumers must collect the objects at a pace that matches the provider. If the memory held by uncollected objects reaches LowThresholdOnObjects, then WMI slows down the addition of new objects into the queue. If uncollected events continue to accumulate and the maximum wait to deliver events in MaxWaitOnClientObjects is reached while the memory used is at the value in HighThresholdOnClientObjects, then WMI accepts no more objects from providers and returns WBEM_E_OUT_OF_MEMORY to the clients. Unit: objects per second CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| HighThresholdOnEvents# | uint32 | read/write | Maximum rate at which events are to be delivered to clients. To accommodate speed differentials between providers and clients, WMI queues events before delivering them to consumers. For more efficiency, consumers must collect the events at a pace that matches the provider. If the memory held by uncollected events reaches LowThresholdOnObjects, then WMI slows down the addition of new events into the queue. If uncollected events continue to accumulate and the maximum wait to deliver events in MaxWaitOnEvents is reached while the memory used is at the value in HighThresholdOnEvents, WMI accepts no more events from providers and returns WBEM_E_OUT_OF_MEMORY to the clients. Note: Throttling is only done for Permanent Event consumers, so temporary consumers should not expect throttling when events get backed up in the WMI internal event queue. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\ CIMOM|High Threshold On Client Objects (B) Unit: events per second CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| InstallationDirectory# | string | read | Directory path where the WMI software has been installed. The default location is \System32\Wbem. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|Installation Directory Code | ||||||||||||
| LastStartupHeapPreallocation# | uint32 | read | Size of the pre-allocated heap created by WMI during initialization. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|CIMOM|LastStartupHeapPreallocation Unit: bytes Code | ||||||||||||
| LoggingDirectory# | string | read/write | Directory path that contains the location of the WMI system log files. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|CIMOM|Logging Directory CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| LoggingLevel# | uint32 | read/write | Enabling of event logging and the verbosity level of logging used. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|CIMOM|Logging Values (3)
CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| LowThresholdOnClientObjects# | uint32 | read/write | Rate at which WMI starts to slow the creation of new objects created for clients. To accommodate speed differentials between providers and clients, WMI holds objects in queues before delivering them to consumers. For more efficiency, consumers must collect the objects at a pace that matches the provider. If the rate of requests for objects reaches LowThresholdOnClientObjects, then WMI gradually slows down the creation of new objects to match the client's rate of use. This slowdown starts when the rate at which objects are being created exceeds the value of this property. See HighThresholdOnClientObjects. This property reflects the registry value. KEY_LOCAL_MACHINE\Software\Microsoft\WBEM\ CIMOM|High Threshold On Client Objects (B) Unit: objects per second CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| LowThresholdOnEvents# | uint32 | read/write | Rate at which WMI starts to slow the delivery of new events. To accommodate speed differentials between providers and clients, WMI queues events before delivering them to consumers. For more efficiency, consumers must collect the objects at a pace that matches the provider. If the queue grows out of control, WMI throttles—slows down—the delivery of events gradually to align with the client rate. This slowdown starts when the rate at which events are generated exceeds the value of this property. See HighThresholdOnEvents. Note: Throttling is only done for permanent event consumers, so temporary consumers should not expect throttling when events get backed up in the WMI internal event queue. This property reflects the registry value. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\ CIMOM|High Threshold On Client Objects {B} Unit: events per second CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| MaxLogFileSize# | uint32 | read/write | Maximum size of the log files produced by the WMI service. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|CIMOM|Log File Max Size Unit: bytes CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| MaxWaitOnClientObjects# | uint32 | read/write | Amount of time a newly created object waits to be used by the client before it is discarded and an error value is returned. This property interacts with the LowThresholdOnClientObjects and HighThresholdOnClientObjects properties to throttle—slow down—the delivery of objects to consumers when the consumer is receiving the objects too slowly. Unit: milliseconds CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| MaxWaitOnEvents# | uint32 | read/write | Amount of time for which an event sent to a client is queued before being discarded. This property interacts0 with LowThresholdOnEvents and HighThresholdOnEvents to throttle—slow down—the delivery of objects to consumers when the consumer is receiving the objects too slowly. This property reflects the registry value. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM\ CIMOM|Max Wait On Events (ms) Unit: milliseconds CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | ||||||||||||
| MofSelfInstallDirectory# | string | read | Directory path for applications that install MOF files to the WMI repository. WMI automatically compiles any MOF files placed in this directory and, depending on its success, moves the MOF to a subdirectory labeled good or bad. If the # pragma autorecover command is included, the fully qualified file name is added to the AutorecoverMofs list used when WMI is initializing or recovering the repository. The list determines the order in which MOFs are compiled. This property reflects the value in the registry key. HKEY_LOCAL_MACHINE\Software\Microsoft\WBEM|CIMOM|MOF Self=Install Directory Code | ||||||||||||
| SettingID# | string | read | Identifier by which the current object is known. Code |
Remarks
The Win32_WMISetting class is derived from CIM_Setting. Only one instance of this class can exist on a computer.
Knowing how WMI is configured on a computer can be very useful when you are debugging scripts or troubleshooting problems with the WMI service itself. For example, many WMI scripts are written under the assumption that root\cimv2 is the default namespace on the target computer. As a result, script writers who need to access a class in "Root\CIMv2" often fail to include the namespace in the GetObject moniker, as shown in the following code sample:
Set colServices = GetObject("winmgmts:").ExecQuery ("SELECT * FROM Win32_Service")
If root\cimv2 is not the default namespace on the target computer, this script will fail. To prevent this from happening, the namespace root\cimv2 must be included in the moniker, as shown in the following code sample:
Set colServices = GetObject("winmgmts:root\cimv2").ExecQuery("SELECT * FROM Win32_Service")
If the default namespace on the target computer is different from the namespace assumed by a script, the script will fail. On top of that, the user will be presented with the somewhat misleading error message "Invalid class." In truth, the failure is not because the class is invalid but because the class cannot be found in the default namespace. This is a difficult problem to troubleshoot, because you are likely to investigate possible problems with the class rather than problems with the namespace that was (or, in this case, was not) specified.
You can use the Win32_WMISetting class to determine how WMI has been configured on a computer. Configuration details such as the default namespace or the WMI build number can be useful in troubleshooting script problems. These settings also provide important administrative information such as how, or even whether, WMI errors are logged on a computer and which WMI providers will automatically be reloaded if you need to rebuild the WMI repository.
Inheritance
Superclass chain
- CIM_Setting
- Win32_WMISetting
Known subclasses
No known subclass.
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- Provider
- WBEMCORE
- MOF file
- CIMWin32.mof
- DLL
- Wbemcore.dll
Class qualifiers
Singleton Dynamic Provider("WBEMCORE") UUID("{A83EF166-CA8D-11d2-B33D-00104BCC4B4A}") AMENDMENT
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.