Hey guys I'm having a funny issue using winmgmts...we have a VPN connecting multiple physical locations. One method of connecting to remote machines works for machines local to the location the script is running from and the other method works for machines local to locations elsewhere.
Method 1:
'~ works for machines local to the network the script runs from
Set objWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt,authority=ntlmdomain:domain.com}!//" & strComputer & "\root\cimv2")
Method 2:
'~ works for machines outside the network the machine the script runs on
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2",,,,"ntlmdomain:domain")
objWMIService.Security_.ImpersonationLevel = 3
Any thoughts on why this may be the case?
The error I seem to get in both scenarios references the RPC server being unavailable, however its the same all the time, I think it might be misleading.
Method 1:
'~ works for machines local to the network the script runs from
Set objWMIService = GetObject("Winmgmts:{impersonationLevel=impersonate,authenticationLevel=Pkt,authority=ntlmdomain:domain.com}!//" & strComputer & "\root\cimv2")
Method 2:
'~ works for machines outside the network the machine the script runs on
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objSWbemLocator.ConnectServer(strComputer, "root\cimv2",,,,"ntlmdomain:domain")
objWMIService.Security_.ImpersonationLevel = 3
Any thoughts on why this may be the case?
The error I seem to get in both scenarios references the RPC server being unavailable, however its the same all the time, I think it might be misleading.