SWbemPrivilegeSet object
An SWbemPrivilegeSet object is a collection of SWbemPrivilege objects in an SWbemSecurity object that requests specific privileges for a Windows Management Instrumentation (WMI) object. See the list of privileges in Privilege Constants. Items are added to the collection using the Add and AddAsString methods. Items are retrieved from the collection using the Item method, and removed using the Remove method. This object cannot be created by the VBScript CreateObject method call. For more information, see Accessing a Collection.
An SWbemPrivilegeSet object is a set of privilege override requests for a specific object. When an API call is made using this object, the privilege override requests are attempted. The SWbemPrivilegeSet object does not define the privileges available to the current user or process. In other words, obtaining the privileges for any WMI object does not identify the privilege settings that are made on the connection to WMI, or the privileges in effect when an object is delivered to a sink.
Members
The SWbemPrivilegeSet object has these types of members:
Methods
The SWbemPrivilegeSet object has these methods.
| Method | Description |
|---|---|
| Add |
Adds an SWbemPrivilege object to the SWbemPrivilegeSet collection using a WbemPrivilegeEnum constant. |
| AddAsString |
Adds an SWbemPrivilege object to the SWbemPrivilegeSet collection using a privilege string. |
| DeleteAll |
Deletes all the privileges from the collection. |
| Item |
Retrieves an SWbemPrivilege object from the collection. This is the default method of this object. |
| Remove |
Removes an SWbemPrivilege object from the collection. |
Properties
The SWbemPrivilegeSet object has these properties.
| Property | Access type | Description |
|---|---|---|
| Read-only |
The number of items in the collection. |
Examples
The following VBScript code example obtains an SWbemPrivileges object and adds all the available privileges to the collection by privilege value, as defined in WbemPrivilegeEnum
strComputer = "." Set objWMIService = GetObject("winmgmts:\\" _ & strComputer & "\root\cimv2") set colPrivileges = objWMIService.Security_.Privileges For I = 1 To 27 colPrivileges.Add(I) Next ' Display information about each privilege For Each objItem In colPrivileges wscript.echo objItem.Identifier & vbtab & objItem.Name _ & vbtab & objItem.Displayname _ & vbtab & "Enabled = " & objItem.IsEnabled Next
Requirements
|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Type library |
|
|
DLL |
|
See also
- Executing Privileged Operations
- Executing Privileged Operations Using VBScript
- WbemPrivilegeEnum
- Scripting API Objects
- Privilege Constants
Send comments about this topic to Microsoft
Build date: 11/19/2012