勇芳软件工作室.汉化:  Windows Management Instrumentation > Scripting API for WMI > Scripting API Objects > SWbemPrivilegeSet >

Item Method

Previous pageReturn to chapter overviewNext page

描述

 

SWbemPrivilegeSet对象的项目方法从集合返回一个SWbemPrivilege对象。项目方法是SWbemPrivilegeSet对象的默认方法。

 

PowerBASIC 语法

 

PROPERTY GET Item ( _

BYVAL iPrivilege AS LONG _

) AS ISWbemPrivilege

 

参数

 

iPrivilege

 

LONG.需要。来自WbemPrivilegeEnum组的WMI常量之一。这些常数本质上是表示特定权限的整数。例如,要获得允许您关闭Windows NT或Windows 2000系统的权限,请使用wbemPrivilegeShutdown常量或等价于23(&H17)的数字。

 

返回值

 

如果成功,则返回请求的SWbemPrivilege对象。

 

OBJRESULT

 

错误(名称/十进制/十六进制)

含义

wbemErrFailed

-2147217407

&H80041001

未指定错误

wbemErrNotFound

-2147217406

&H80041002

指定的权限不存在。

 

示例代码[VBScript]

 

以下VBScript代码示例使用项目方法

 

strComputer =“。”

设置objWMIService = GetObject(“winmgmts:”_

 &“{impersonationLevel = impersonate}!\\\\”&strComputer _

 &“\\ root \\ cimv2”)

设置colServices = objWMIService.ExecQuery(_

 “从Win32_Service中选择*”)

对于colServices中的每个objService

 WScript.Echo objService.Properties_.Item(“Caption”)

下一个

 

要求

 

客户

需要Windows Vista,Windows XP,Windows 2000 Professional,Windows NT Workstation 4.0 SP4及更高版本,Windows Me,Windows 98或Windows 95 OSR2及更高版本。

服务器

需要Windows Server 2008,Windows Server 2003,Windows 2000 Server或Windows NT Server 4.0 SP4及更高版本。

类型库

使用Wbemdisp.tlb。

Wbemdisp.inc。

DLL

需要Wbemdisp.dll。