Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Timeout for GetObject (winmgmts)

Status
Not open for further replies.

sunny001

Programmer
Feb 6, 2004
6
AT
I try to connect to a remote Computer to get the CurrentUser. Ping is ok. No error occurs, but the script halts while executing this statement:

Set oSys = GetObject("winmgmts:" & _
"{impersonationLevel=impersonate}" & _
"!//" & machine & _
"/root/cimv2:Win32_ComputerSystem=""" & _
machine & """")

It seems that the WMI Service at the remote computer doesn't respond (I can't even stop this service).

Is it possible to set a reasonable timeout!?
 
Hello sunny001,

Would indeed be nice to have it. For the moment, only winxp has the implementation of a flag wbemConnectFlagUseMaxWait:


running through the code like:
Code:
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objService = objLocator.ConnectServer(strServer, strNameSpace,,,,, wbemConnectFlagUseMaxWait)
WMI is evolving strong. Very uncertain in many areas if loosening the grip a minute, not many have sufficient time and working environment to catch up.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top