Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Connect to WMI remotely

1 view
Skip to first unread message

swimmingfisher

unread,
Feb 10, 2010, 7:21:18 AM2/10/10
to
Hi guys,

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

0 new messages