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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WMI Timeout

Status
Not open for further replies.

djtech2k

MIS
Jul 24, 2003
1,097
0
0
US
I have some scripts that I use to do remote WMI connections. The problem is that sometimes it hangs because it gets no response from WMI, but never errors so it just its there.

Anyone know if it is possible to set a timer or lower the WMI connection timeout setting?
 
Which phase of the WMI connection does it hang? When you create the WMI connection object or when you perform the query?

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
I cannot say 100%, but I think its when execs the query. Again, I cannot say 100%.
 
Is the problem always against the same host or set of hosts?

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
The problem was reported to me one of a couple of servers, but once I realized the problem, I think this may have been a factor with other scripts over time.
 
In my experience, there are a few things that have caused me problems:

1) WMI / COM security blocks remote scripting
2) WMI repository is corrupt
3) WMI service instance has become corrupt (a service restart fixes this)
4) Firewall rules (I am currently troubleshooting this)

I recommend that you ping each server before you attempt to connect to it (I have some code for this that I'll post later). After that you are going to need to write code around the following points to trap the error:

1) Connection phase (oWMI = GetObject("winmgmts://<remotehost>/Root/CIMv2"))
2) Query phase (cItems = oWMI.ExecQuery("SELECT * FROM ..."))
3) Results phase (For Each oInstance in cItems...Next)

I've had problems in each of these phases (most recently the 3rd, which turned out to be the WMI service restart issue listed above)

PSC

Governments and corporations need people like you and me. We are samurai. The keyboard cowboys. And all those other people out there who have no idea what's going on are the cattle. Mooo! --Mr. The Plague, from the movie "Hackers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top