SWbemPrivilegeSet.Add method
The Add method of the SWbemPrivilegeSet object adds an SWbemPrivilege object to the SWbemPrivilegeSet collection. If a privilege with the same name already exists in the collection, it is replaced.
For an explanation of this syntax, see Document Conventions for the Scripting API.
Syntax
objPrivilege = .Add( _
ByVal iPrivilege, _
[ ByVal bIsEnabled ] _
)
Parameters
-
iPrivilege
-
Required. One of the WMI constants from the WbemPrivilegeEnum group. These constants are essentially integers that represent specific privileges. For example, to add the privilege that allows you to shut down a computer system, use the wbemPrivilegeShutdown constant. In a script, you must use the numeric equivalent of 23 (0x17). For a complete list of these constants and the associated privilege strings, see Privilege Constants.
-
bIsEnabled [optional]
-
Boolean value that enables or disables this privilege. The default value is TRUE.
Return value
If successful, the method returns an SWbemPrivilege object that represents the new privilege. Otherwise, a null object is returned.
Error codes
Upon the completion of the Add method, the Err object may contain the error code in the following list.
-
wbemErrFailed - 2147749889 (0x80041001)
-
Unspecified error.
Examples
A code example using this method is described in the SWbemPrivilegeSet topic.
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Header |
|
Type library |
|
DLL |
|
CLSID |
CLSID_SWbemPrivilegeSet |
IID |
IID_ISWbemPrivilegeSet |