【发布时间】:2011-11-21 21:27:10
【问题描述】:
在 VB.Net 中,我尝试使用不同的凭据(用户没有管理员权限)连接到本地计算机上的 WMI,但出现此异常:
« 用户凭据不能用于本地连接 »
代码如下:
Dim path As ManagementPath = Nothing
Dim options As ConnectionOptions = Nothing
Dim scope As ManagementScope = Nothing
path = New ManagementPath("\\" & vServerName & "\root\CIMV2")
options = New ConnectionOptions
options.Username = vUsername
options.Password = vPassword
Scope = New ManagementScope(path, options)
Scope.Connect()
【问题讨论】: