描述
ImpersonationLevel属性是一个整数,用于定义分配给此对象的COM模拟级别。此设置确定Windows Management Instrumentation(WMI)拥有的进程是否可以在调用其他进程时检测或使用安全凭据。有关模拟级别的更多信息,请参阅设置Client_Application_Process安全性.
如果您未将模拟级别设置为昵称,或者通过将SWBemSecurity.ImpersonationLevel属性设置为安全对象,则WMI将默认模拟级别设置为默认模拟级别注册表项中指定的值。Windows 2000,Windows XP和Windows Server 2003的此注册表值设置为wbemImpersonationLevelImpersonate.以前版本的WMI将默认模拟级别设置为WbemImpersonationLevelIdentify.如果此设置不足,则提供商不会为您的请求提供服务,并且对WMI API的调用可能会失败,错误代码为wbemErrAccessDenied(-2147217405 / &H80041003))。
PowerBASIC 语法
PROPERTY GET ImpersonationLevel () AS LONG PROPERTY SET ImpersonationLevel (BYVAL iImpersonationLevel AS LONG) |
参数(仅限设置属性)
iImpersonationLevel
LONG.假冒级别
返回值(仅获取资源)
LONG.假冒级别
备注
您可以通过将ImpersonationLevel属性设置为所需值来设置SWbemServices,SWbemObject,SWbemObjectSet,SWbemObjectPath和SwbemLocator对象的模拟级别。以下示例说明如何设置SWbemObject对象的模拟级别:
objinstance.Security_.ImpersonationLevel = _
wbemImpersonationLevelImpersonate
您还可以将模拟级别指定为绰号的一部分。以下示例设置身份验证级别和模拟级别,并检索Win32_Service的实例。
Set objinst = GetObject("WinMgmts:{impersonationLevel=impersonate,"& _
"authenticationLevel=pktPrivacy}"& _
"!root/cimv2:Win32_service='ALERTER'")
要求
客户 |
需要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。 |