JonnyThunder Posted July 1, 2008 Share Posted July 1, 2008 Hello again, Right. I've written a rather complicated script which scans all the PCs listed in our Active Directory and scans them for various things. The problems begin, when using WMI connections. If a machine has issues with WMI - often the script will just hang. Now, out of 5000+ PCs on our network, only a handful have WMI issues. I've adapted the script to automatically add the last failed machine to an exclude list - but currently have no way of killing the script if the process hangs. So... my question is... Is there any way to either (1) automatically kill the scripts process if the process hangs or (2) kill the script with another external detection script, based on it hanging? Ooh, good one for a tuesday morning! Many thanks, JT Link to comment Share on other sites More sharing options...
TerarinKerowyn Posted July 1, 2008 Share Posted July 1, 2008 Yes you can set up a poll and do it that way or Adlib to do that for you on each one of the PC's Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 1, 2008 Moderators Share Posted July 1, 2008 Might try using 2 scripts.1. Main script, on startup get a list of AutoIt windows, match their PIDs to your newly launched app.2. Once you find the right Hwnd, send that in a command line to the "watcher" app.3. In the watcher app, loop through using a dll call for IsHungAppWindow : http://msdn.microsoft.com/en-us/library/ms633526(VS.85).aspxI could have sworn someone wrote something up for checking if a process is hung, but my search terms may be incorrect... I thought I remembered them using GetProcessIOCounters but that search didn't turn it up either.Any, the quickest solution I can think of off the top of my head above. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JonnyThunder Posted July 2, 2008 Author Share Posted July 2, 2008 hi there, thanks for your responses. Okay, i've only got one window which does everything - so getting the PID should be easy enough. I can call another autoit script and pass that ID - but how do I do the 'step 3' part within AutoIT? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 2, 2008 Moderators Share Posted July 2, 2008 Well, just pass your PID (I was talking about window handles, not process id's... but let's do it with process id's that way you only have to pass @AutoItPID in the main app to the watcher). (None of this is tested, just pseudo mainly): Main App:Run('"' & $s_Watcher_Location_Name & '" ' & @AutoItPID) ; Somewhere in here before you actually exit your main app ; Be sure to close the watcher appoÝ÷ Ùfr«ZºÚ"µÍÈØ]ÚYÝ ÌÍØÛY[VÌH[SÙÐÞ M ][ÝÑÜ][ÝË ][ÝÖ[ÝH]ÝÜÈHÛÛ[X[[HÈYK][ÝÊBQ^]B[YÛØ[ ÌÍÚWÔQH ÌÍØÛY[VÌWK ÌÍØWÒÒ[ÂÛØ[ ÌÍØWÕÙÌHÜ[ ][ÝÕÙÌ ][ÝÊBY ÌÍØWÕÙÌHLH[^]YØÙÜÑ^ÝÊ ÌÍÚWÔQ H[^]ÂÛØ[ ÌÍÚXØË ÌÍÚØÛ ÌÍØWÕÚ[ÝHÚ[Ý ][ÝÖÐÓTÔÎ]]Ò]×I][ÝÊBÜ ÌÍÚXØÈHHÈ ÌÍØWÕÚ[ÝÌVÌBRYÚ[Ù]ØÙÜÊ ÌÍØWÕÚ[ÝÉÌÍÚXØ×VÌWJHH ÌÍÚWÔQ[BIÌÍÚØÛHÛ ÌÍØWÕÚ[ÝÉÌÍÚXØ×VÌWJBBQ^]ÛÜQ[Y^Y ÌÍÚØÛH ][ÝÉ][ÝÈ[^] Ú[HØÙÜÑ^ÝÊ ÌÍÚWÔQ BIÌÍØWÒÒ[ÈHØ[ ÌÍØWÕÙÌ ][ÝÚ[ ][ÝË ][ÝÒÒ[ÐÚ[ÝÉ][ÝË ][ÝÚÛ ][ÝË ÌÍÚØÛ BRYÐ^J ÌÍØWÒÒ[ÊH[ ÌÍØWÒÒ[ÖÌH[BNÈ]ØÈØ]Ú[È]Z]ÜÛ[ÂBNÈ]ÛÛY][ÈHÈÂBNÈØÙÜÐÛÜÙBBNÈÙÈ]ËQ[YTÛY L BÑ[[ÈÛ]]Ò]^] BRYÑXÛY ][ÝØWÕÙÌ][ÝÊH[ÛÜÙJ ÌÍØWÕÙÌBNÈX^HØ[ÈÙÈÛÛY][ÈB[[ Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
JonnyThunder Posted July 3, 2008 Author Share Posted July 3, 2008 Thank you for your reply - thats really helpful. I'm going to have a play around with it and see if I can resolve the issue. We noticed something else happening on the PC which is doing the scanning. It seems that after a couple of thousand PCs - the script starts bombing out all attempts to connect to anything with WMI (until after you reboot). Hmmmm. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now