下面是一个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和其他一些链接
答案 0 :(得分:0)
您必须确保客户端授予权限从远程运行wmi脚本。允许在客户端上运行wmi remote命令:
netsh advfirewall firewall set rule group =“windows management instrumentation(wmi)”new enable = yes