Scripting API Constants
2 minutes to read
In this article
WMI uses several types of constants in the
iflags parameter of method calls in the Scripting API for WMI.
Visual Basic applications can include the type library for the scripting API, Wbemdisp.tlb. Scripts are unable to access constants in the type library unless they use the
tags from the Windows Script Host (WSH) XML file format as described in Using the WMI Scripting Type Library. Otherwise, a script must use the value of the constant.
Define the security authentication levels.
Define how a write operation to a class or an instance is carried out.
Define the valid CIM types of a property value.
Define the settings for object comparison and are used by
Defines a security flag that is used as a parameter in calls to the
method when a connection to WMI on a remote machine is failing. SWbemLocator.ConnectServer
Define the errors that may be returned by
Scripting API for WMI calls.
Defines constants that are used by
, SWbemServices.ExecQuery , SWbemServices.ExecQueryAsync , and SWbemServices.SubclassesOf . SWbemServices.InstancesOf
Define the security impersonation levels. These constants are used with
Define the valid object text formats to be used by
Define privileges. These constants are used with
to grant the privileges required for some operations. SWbemSecurity
Define the depth of enumeration or query, which determines how many objects are returned by a call.
Defines the content of generated object text and is used by
Defines the time-out constants. This constant is used by
. SWbemEventSource.NextEvent Combining Flags
You can combine flags to affect more than one aspect of the API call.
For example, to create a
call, the semisynchronous iFlags parameter in an call must contain two flags: SWbemServices.ExecQuery_ WbemFlagReturnImmediately and WbemFlagForwardOnly. The value of WbemFlagReturnImmediately is 16 and the value of WbemFlagForwardOnly is 32. Because the constants cannot be accessed by name, the values of these flags are combined, producing an iFlags value of 48.
The following script example shows the call.
On Error Resume Next
For Each obj in GetObject("WinMgmts:").ExecQuery _
("SELECT * FROM Win32_NTLogEvent WHERE _ LogFile='Application'",,48)
count = count + 1
Not all flags can be combined since many are mutually exclusive and may produce unpredictable results.
Scripting API for WMI