WMI hangs
Keywords:
Question:
I am running the following code on a Win2K machine connecting to a remote Win2K server (both SP2) and the script is hanging on lineObj = ObjectCollectionNext(hEnum)It would (did) sit there for days if I left it. It hung when compiled (that's when I noticed it) and it also hangs when I run it though WB-Studio and stepping into each line.CurServer = "RF2SZWDB12N1" Locator = ObjectOpen("WbemScripting.SWbemLocator") Service = Locator.ConnectServer(CurServer,"root/cimv2","UserName","Password") Security = Service.Security_ Security.ImpersonationLevel = 3 Class = "Win32_ComputerSystem" Instance = Service.InstancesOf(Class) hEnum = ObjectCollectionOpen(Instance) Obj = ObjectCollectionNext(hEnum) Txt = Obj.Manufacturer Message("Manuf",Txt) ObjectCollectionClose(hEnum) ObjectClose(Instance) ObjectClose(Security) ObjectClose(Service) ObjectClose(Locator) There are no errors recorded in a debug trace e.g. CurServer = "RF2SZWDB12N1" (10) VALUE=> "RF2SZWDB12N1" Locator = ObjectOpen("WbemScripting.SWbemLocator") (30) VALUE=> 33333 Service = Locator.ConnectServer(CurServer,"root/cimv2","Username","Password") (211) VALUE=> 33334 Security = Service.Security_ (211) VALUE=> 33335 Security.ImpersonationLevel = 3 (211) VALUE=> 3 Class = "Win32_ComputerSystem" (211) VALUE=> "Win32_ComputerSystem" Instance = Service.InstancesOf(Class) (251) VALUE=> 33336 hEnum = ObjectCollectionOpen(Instance) (251) VALUE=> 18243968Any chance of getting a timeout value written in to the function, or can you think of other reasons why it would be hanging?Answer:
Hmm. Not sure what going on. I am unable to recreate the problem. Maybe try downloading the WMI administrative tool from here: http://www.microsoft.com/downloads/release.asp?ReleaseID=40804&area=search&ordinal=5See if you can use the WMI Object Browser to browse to that same remote machine and access the Manufacturer information....
Let us know the results.
User Reply:
Calls to the same WMI key was happening from other sources as well (VBScript, WMI Browser, etc) so must be a server problem. However, a timeout value on the WMI commands would still be of benefit to prevent a problem on a server like this completely hanging up a script.Conclusion:
It would be nice, but we have no place to plug one in. We just pass control to windows and await some response.
Article ID: W15365