SWbemPrivilegeSet.Item method

The Item method of the SWbemPrivilegeSet object returns an SWbemPrivilege object from the collection. The Item method is the default method of an SWbemPrivilegeSet object.

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

Syntax

objPrivilege = .Item( _
  ByVal iPrivilege _
)

Parameters

iPrivilege

Required. One of the WMI constants from the WbemPrivilegeEnum group. These constants are essentially integers that represent specific privileges. For example, to get the privilege that allows you to shut down a Windows system, use the wbemPrivilegeShutdown constant or the numeric equivalent of 23 (0x17).

Return value

If successful, the requested SWbemPrivilege object is returned.

Error codes

Upon the completion of the Item method, the Err object may contain one of the error codes in the following list.

wbemErrFailed - 2147749889 (0x80041001)

Unspecified error.

wbemErrNotFound - 2147749890 (0x80041002)

Specified privilege does not exist.

Examples

The following VBScript code example uses the Item method

strComputer ="."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer _
    & "\root\cimv2")
Set colServices = objWMIService.ExecQuery( _
    "Select * from Win32_Service")
For Each objService In colServices
    WScript.Echo objService.Properties_.Item("Caption")
Next

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_SWbemPrivilegeSet
IID
IID_ISWbemPrivilegeSet

See also

SWbemPrivilegeSet

Executing Privileged Operations

SWbemPrivilege