下面是一个 WMI 脚本,它给出了网络共享的本地路径。它给出了错误
Script: D:\Desktop\nvt.vbs
Line: 11
Char: 1
Error: Access is denied.
Code: 80070005
Source: SWbemLocator
这是代码
strPath = "\\pc132\d"
strPath = Replace(strPath, "\\", "")
arrPath = Split(strPath, "\")
strComputer = arrPath(0)
strShare = arrPath(1)
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer("PC132", "\\pc132\root\cimv2", "username", "password")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_Share Where Name = '" & strShare & "'")
For Each objItem in colItems
Wscript.Echo objItem.Path
Next
我确实使用 pc.WMI、RPC、RPC 定位器等服务的管理员登录正在运行。我已经在 dcomcnfg 的 COM 安全中给予了完全许可。我也给予了 root/cimv2 等的许可。但仍然得到错误。所以请帮助我。我已经参考了http://msdn.microsoft.com/en-us/library/windows/desktop/aa394603(v=vs.85).aspx 和其他一些链接