I'm trying to connect to WMI remotely with vbscript, Is anyone have
some idea to share, thanks in advance.
it failed in this way, the credential was not provided here because i
had used administrator account to log on the remote host via Remote
Desktop Connection before execution.
strComputer = "sh-server03"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & _
"\root\cimv2")
However it works in this way
strComputer = "sh-server03"
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer _
(strComputer, "root\cimv2", "administrator", "shserver")
objSWbemServices.Security_.ImpersonationLevel = 3
BTW, i'm using Windows xp 32bit with sp3, Windows Firewall was turned
off both for local and remote host.
Thanks guys,
Matthew