| |
Mooky
Posts: 1
Score: 0
Joined: 3/3/2005
From:
Status: offline
|
I am using a script that collects information through WMI calls to remote computers on a pure Windows 2000 platform (WIn2K computers talking to other Win2K computers) In the script, it uses various ExecQuery calls to the objWMI object which I can set up successfully with either of these calls: Set objWMI = objLocator.ConnectServer(hostName,nameSpace) (objLocator is a WbemScripting.SWbemLocator object) -OR- Set objWMI = GetObject("winmgmts:\\" & hostName & "\" & nameSpace) It works great for the most part...when I run across a system that the user running the script doesn't have rights to, I get the expected error and can trap it accordingly. The problem is that once in a blue moon I'll hit a system that returns NO errors at all...in fact, it never returns from the Set objWMI call at all. It just hangs there indefinitly. I've read traffic about using the wbemConnectFlagUseMaxWait flag in the ConnectServer call, but that isn't available on the Win2K platform (only works in XP/2003). Any way to have this call timeout? I've thought about using asynchrnous execution instead of looping, that way I could simply timeout one of the instances if it doesn't return from the ConnectServer call...but I'm not certain how I can set up asynchronous execution of a whole section of code in lieu of using a for each loop from a dictionary object. The catch is that the code needs to reference several dictionary objects and make edits to an OLE data repository while it loops through the code. All that works fine...just this snag with the WMI timeout thing. The basic code does this: 1) retrieve list of systems from an OLE source 2) retrieve list of systems from AD and compare against list from #1 3) loop through all systems Each loop does the following 3.1) ping the remote system to ensure it can be reached 3.2) connect to the remote machines WMI service 3.3) collect WMI data 3.4) compare collected data to preexisting data from the OLE source 3.5) update the OLE source where necessary 4) report totals for updates and what not If I could figure out how to loop through the systems asynchrnously that would not only speed up the time it takes to execute (right now about 30 minutes for ~600 systems) but it would probably solve the issue with the WMI call getting stuck. Help anyone? and PLEASE PLEASE reply to me by eMail as I don't this forum regularly... keith AT indigotechnologies DOT us Thanks!
|
|