Cerixus
asked on
Cancel WMI query while it is in process? (because it hangs)
I'm doing some WMI queries on about 3000 machines. The problem is, some of those machines are in a hung state and when I do the query, the ASP script just locks up indefinitely. The only fix is restarting IIS. I am using win32_pingstatus before I do the queries to determine if the server is online. The servers in question respond saying they are online, but any following WMI queries cause the process to hang. What I need to know is a good way to detect when this has happened and continue to the next server in the loop.
You could try "net use \\fqdn" and check the return status of that instead of ping, this wouldn't actually stop all queries from hanging, but it would greatly reduce the number of false positives in your alive check.
ASKER
I tried NET USE on 3 different servers. One known good Windows, one known Linux and one known to be locked up Windows. All three responded with "The command completed successfully."
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Creating a separate process was just an additional thought. What I really want, and what I would think should be TOTALLY possible, is a way to detect how long the WMI query has been running, or even a particular ASP function, and break out of it.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, as it's usually the GetObject calls that hangs, such as:
strComputer = "pcname"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper sonate}!\\ " & strComputer & "\root\cimv2")
the GetObject method does not support any configurable time-out setting:
http://msdn.microsoft.com/en-us/library/8ywk619w(VS.85).aspx
Regards,
Rob.
strComputer = "pcname"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=imper
the GetObject method does not support any configurable time-out setting:
http://msdn.microsoft.com/en-us/library/8ywk619w(VS.85).aspx
Regards,
Rob.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sciphre,
ASP.NET is a completely different technology and framework than ASP (classic). I may have been wrong and assumed this wasn't .NET so the Asker should clarify this but the article you found won't help if this isn't .NET. Indeed .NET does support what you say and probably could stop the process. Unfortunately you can't use both on a page (Classic and .NET) so it would mean a complete rewrite if this is Classic ASP.
Thanks for posting in case I did make a mistake. My comments were all about Classic ASP. It seems like you are new here but off to an impressive start. :) Good job and thanks for your help and time with the members.
bol
p.s. I'm glad you mentioned your experience level on this. Nice thing to see in a case like this.
ASP.NET is a completely different technology and framework than ASP (classic). I may have been wrong and assumed this wasn't .NET so the Asker should clarify this but the article you found won't help if this isn't .NET. Indeed .NET does support what you say and probably could stop the process. Unfortunately you can't use both on a page (Classic and .NET) so it would mean a complete rewrite if this is Classic ASP.
Thanks for posting in case I did make a mistake. My comments were all about Classic ASP. It seems like you are new here but off to an impressive start. :) Good job and thanks for your help and time with the members.
bol
p.s. I'm glad you mentioned your experience level on this. Nice thing to see in a case like this.
ASKER
It is classic ASP.
My apologies - For reasons that are lost to me now Classic ASP was marked in my mind with red, wide, "don't go there" sticky tape a few years back, never really crossed my mind that this wasn't .Net. Call me an elitist jerk :)
I'll remove myself from this conversation.
I'll remove myself from this conversation.
Hi, were you able to try the
If objFSO.FolderExists(strCom puter & "\C$") = True Then
method?
Regards,
Rob.
If objFSO.FolderExists(strCom
method?
Regards,
Rob.
ASKER
RobSampson:
I have not specifically tried that, but since it IS able to initially connect to the server, I'm assuming it will be able to connect to the administrative share for the C drive. But, the WMI query would still stall.
I have not specifically tried that, but since it IS able to initially connect to the server, I'm assuming it will be able to connect to the administrative share for the C drive. But, the WMI query would still stall.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I had a thought... is it possible to query something ELSE to see if I get a response, then execute my query based on that? Like say the Server service? Is there any way I could programmatically see if it responds?
Well, not really, because with VBScript, that would still require a WMI connection....
So you'd have to look at a DOS tool, which *might* return quicker, but seeing as it wouldn't use WMI to connect, then even if that were successful, there's still a possibility that the WMI connection could have problems. That's why Microsoft have a WMI Diagnostics tool (which cannot be run remotely).
Did you try the C$ share approach?
Regards,
Rob.
So you'd have to look at a DOS tool, which *might* return quicker, but seeing as it wouldn't use WMI to connect, then even if that were successful, there's still a possibility that the WMI connection could have problems. That's why Microsoft have a WMI Diagnostics tool (which cannot be run remotely).
Did you try the C$ share approach?
Regards,
Rob.
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If Ping(strComputer) = True Then
If objFSO.FolderExists(strComputer & "\C$") = True Then
' execute WMI query
Else
Respone.Write "Not a Windows machine"
End If
Else
Response.Write "Ping failed for " & strComputer
End If
ASKER
Rewriting entire site in .net
I'm glad I could help a bit. Thanks for the fun question, the grade and the points.
bol
bol
ASKER