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

WbemImpersonationLevelEnum

Previous pageReturn to chapter overviewNext page

WbemImpersonationLevelEnum常量定义安全性模拟级别。这些常数与SWbemSecurity一起使用。

 

WMI脚本类型库wbemdisp.tlb定义了这些常量。Visual Basic应用程序可以访问此库。

 

脚本语言必须使用以下之一:

 

·简称。例如,对于wbemImpersonationLevelImpersonate使用“Impersonate”。

 

以下VBScript代码示例使用短名称。

 

Set objWMIService = GetObject("winmgmts:" _

  & "{impersonationLevel=Impersonate}!\\" _

  & strComputer & "\root\cimv2")

 

·脚本中的Windows脚本宿主(WSH)XML文件格式。例如,这意味着脚本可以直接使用wbemImpersonationLevelImpersonate常量。

 

以下WSH脚本设置模拟级别。要运行脚本,请将文本保存在扩展名为.wsf的文件中。

 

<?xml version="1.0"?>

<job>

<reference object="WbemScripting.SWbemLocator"/>

<script language="VBScript">

  set service = GetObject("winmgmts:")

  ' Following line uses a symbolic

  ' constant from the WMI type library

  service.Security_.impersonationLevel = _

      wbemImpersonationLevelDelegate

</script>

</job>

 

 

恒/值

描述

wbemImpersonationLevelAnonymous

1

&H1

短名称:匿名

 

隐藏呼叫者的凭据。对这个模拟级别的呼叫可能会失败。

wbemImpersonationLevelIdentify

2

&H2

短名称:识别

 

允许对象查询来电者的凭据。对这个模拟级别的呼叫可能会失败。

wbemImpersonationLevelImpersonate

3

&H3

短名称:Impersonate

 

允许对象使用呼叫者的凭据。这是针对WMI调用的脚本API的建议模拟级别。

wbemImpersonationLevelDelegate

4

&H4

短名称:代表

 

Windows 2000及更高版本: 允许对象允许其他对象使用呼叫者的凭据。此模拟将与脚本API配合使用WMI调用,但可能构成不必要的安全风险。

 

要求

 

客户

需要Windows Vista,Windows XP,Windows 2000 Professional,Windows NT Workstation 4.0 SP4和更高版本,或Windows Me。

服务器

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

在Wbemdisp.inc中声明。

类型库

使用Wbemdisp.tlb。

DLL

需要Wbemdisp.dll。