I am receiving the following error when trying to do a remote WMI call:
Failed to parse the script. Error: Source:'Microsoft VBScript runtime error' Line 4 Char:1 Error:0 'Permission denied: 'GetObject''
If I run the following code pointing to my local machine, I receive no error. However, when I run the code pointing to a remote machine I get the error above.
strComputer = "COMPUTER-X"
strService = "Netlogon"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colRunningServices = objWMIService.ExecQuery("Select * from WIN32_Service")
For Each objService in colRunningServices
if objService.DisplayName = strService then
if objService.State = "Running" then
Context.SetValue 1
else
Context.SetValue 0
End If
Else
End If
Next
I have tried the following:
- Turn off firewall on remote machine.
- Change HKLM\Software\Policies\Microsoft\Windows NT\RPC "RestrictRemoteClients" from 2 to 1 on remote machine
- Change Group Policy Computer Configuration\Admistrative Templates\System\RPC "Restrict Unauthenticated RPC clients" and "Enable RPC Endpoint Mapper Client Authenticatin" settings.
Any help would be appreciated!