SWbemSecurity.Privileges property

The Privileges property is an SWbemPrivilegeSet object. This property is used to enable or disable specific Windows privileges. You may need to set one of these privileges to perform specific tasks using the Windows Management Instrumentation (WMI) API.

For an explanation of this syntax, see Document Conventions for the Scripting API.

This property is read-only.

Syntax

SWbemSecurity.Privileges As Object

Property value

Remarks

This setting allows you to grant or revoke privileges as part of a WMI moniker string. For the complete list of applicable values, see WbemPrivilegeEnum and Privilege Constants.

You can change the privileges defined for the SWbemServices, SWbemObject, SWbemObjectSet, SWbemObjectPath, and SwbemLocator objects by adding SWbemPrivilege objects to the Privileges property.

There are fundamental differences in how different versions of Windows handle changes to privileges. If you are developing an application that is only used on Windows platforms, you can set or revoke privileges at any time.

The following example sets the SeDebugPrivilege on the initial moniker connection to obtain an SWbemServices object.

Set Service = GetObject( _
    "winmgmts:{impersonationLevel=impersonate, (Debug)}")

For more information about how to format the security string for a moniker connection, see Privilege Constants.

The following example performs the same task, but it sets the privilege after the initial log on to WMI.

Set Service = GetObject( _
    "winmgmts:{impersonationLevel=impersonate}")
Service.Security_.Privileges.AddAsString "SeDebugPrivilege", True

Note that for calls to SwbemPrivilegeSet.AddAsString, you must use the full name of the security privilege, for example, "SeDebugPrivilege" instead of "Debug".

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Header
Wbemdisp.h
Type library
Wbemdisp.tlb
DLL
Wbemdisp.dll
CLSID
CLSID_SWbemSecurity
IID
IID_ISWbemSecurity

See also

SWbemSecurity

Executing Privileged Operations

SWbemPrivilegeSet