evilertoaster Posted May 30, 2006 Posted May 30, 2006 I'm not sure if this is an autoit or WMI issue but anyways- Is there a way to set a max timeout time for and ObjGet command? Specifically im useing WMI on a remote machine - ObjGet("winmgmts:\\" & $MachineName & "\root\CIMV2") but sometimes it will hang forever on this line. I do my best to make sure it will support wmi first (I check the OS and make sure it's on ect.) but the bottom line is it hangs on the ObjGet forever on some occations... Is there anyway to set a timeout limit of say 3 seconds to the function?
Xenobiologist Posted June 5, 2006 Posted June 5, 2006 HI, have you tried to set a hotkey to end the script or exit the func? So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
MFerris Posted June 5, 2006 Posted June 5, 2006 I'm probably not very qualified to help here as I've just started exploring the wide world of DLLs and 'Obj'.. but.. Can you somehow implement the "IsObj" command? (Perhaps that's only useful after you've used the ObjGet, which is where you're having a problem.) Alternately, could you copy the file to your machine locally so that you're not loading it over the network? I'm not familiar with WMI so perhaps that's not an option. And are you sure it's not failing? Have you checked for @error after attempting ObjGet? I assume you're checking to make sure the file exists at the given path as well. Good luck.
evilertoaster Posted June 5, 2006 Author Posted June 5, 2006 have you tried to set a hotkey to end the script or exit the func?Yes. But there are two problems with this- 1. AutoIt is in a sort of 'softfreeze' while its doing ObjGet("winmgmts:\\" & $Mname & "\root\CIMV2"). Meaning that if I set a hotkey to some button and press it, the function will only run after the ObjGet command finishes (up to 2 or 3 minutes sometimes) 2. I would like it to automatically break not me have to tell it when. I'm probably not very qualified to help here as I've just started exploring the wide world of DLLs and 'Obj'.. but..Me too^^ Welcome to the club Can you somehow implement the "IsObj" command? (Perhaps that's only useful after you've used the ObjGet, which is where you're having a problem.)I don't think so...like you said the "ObjGet" command RETURNS an object (or should) so you'd test the return value...I guess I'm looking for an "IfWouldBeObj" command And are you sure it's not failing? Have you checked for @error after attempting ObjGet? I assume you're checking to make sure the file exists at the given path as well.Yes, in fact I'm sure it's failing on these occasions (if it takes more than a few seconds). I put message boxes right before and after- MsgBox(0,"Test","Starting - " & $Mname) $objWMIService = ObjGet("winmgmts:\\" & $Mname & "\root\CIMV2") MsgBox(0,"Test","Ending - " & $Mname) It will give the first Msg but not the second (until some minutes later) The path "winmgmts:\\" & $Mname & "\root\CIMV2" should exist on every WMI compatable computer if I'm not mistaken. I do make sure it's on and all that. Plus this is being ran in a lab where 25 computers are all imaged the same. Only on some occations will this freeze but only on 1 computer...it usually works fine
Mac3051 Posted June 7, 2006 Posted June 7, 2006 I have been having the same problem with a few polling WMI scripts I have been working on. Running a quick search with regard to your problem; I came up with a few articles which seemed worth the read:WMIhttp://www.microsoft.com/technet/scriptcen...s/help/wmi.mspxMSDN WMI reference guide:http://msdn.microsoft.com/library/default...._start_page.aspHope this helps, my idea was that you ran either the command FileGetVersion or checked a registry value to make sure that WMI was the same on the remote computer as on the one where you're not getting the error.Hope this helps, and good luck,RMc
evilertoaster Posted June 7, 2006 Author Posted June 7, 2006 Yes, I looked though most of the WMI documentation, but it didn't really have any applicable advice to this situation. See the problem is that the GetObj commands just takes forver if for some reason WMI doesn't want to work.Hope this helps, my idea was that you ran either the command FileGetVersion or checked a registry value to make sure that WMI was the same on the remote computer as on the one where you're not getting the error.No. I know they have WMI becuase the base image does and they are all imaged the same. Additionally it's not an individual computer that I'm having problems with. It may run fine on the whole lab one day and the next minute one of them may freeze on the GetObj command. What I'm really looking for is a either a wasy to tell WMI to stop trying to connect after about 5 seconds or tell the ObjGet command to stop trying the function after about 5 seconds. As is it will keeptrying to connect for a a few minutes, during which time the script stops responding (it will usually recover after a few mintes and the GetObj returns a nothing - "" ).
twbradio Posted June 8, 2006 Posted June 8, 2006 I am having the exact same issue - when dealing with remote computers, every now and then the wmi is broken - and the script freezes indefinately. I am to the point that I am willing to compile the WMI check portion of my script as a seperate executable and run it with the machine name as an argument - if it runs too long or gets hung up, the main program can terminate the process. I just do not have a clean way of getting th results back to my main program yet - however, I would love to have this available in the language so that I do not have to fiddle around with it. Anyone have a TRS 80 Model III for sale?
evilertoaster Posted June 8, 2006 Author Posted June 8, 2006 I guess you could use that COroutine UDF in the scripts and scraps (by neogia)... but thats kind of a not so elegant work around IMO. No one knows a way to make WMI or GetObj have a max timeout? Maybe it could be somthing added to the next beta?(who wrote the Com/Obj stuff?). I think I heard someone say that autoit should never hard crash which it appears to be doing....so maybe its a bug?
rehnmark Posted May 21, 2007 Posted May 21, 2007 (edited) I guess you could use that COroutine UDF in the scripts and scraps (by neogia)... but thats kind of a not so elegant work around IMO. No one knows a way to make WMI or GetObj have a max timeout? Maybe it could be somthing added to the next beta?(who wrote the Com/Obj stuff?). I think I heard someone say that autoit should never hard crash which it appears to be doing....so maybe its a bug?Having the same problem to, if the WMI doesnt answer, autoit hangs when it comes to "ObjGet("winmgmts:\\" & $computername & "\root\CIMV2")" for about 30-60secs then it continues the script ... Edited May 21, 2007 by rehnmark
Ktulu789 Posted October 28, 2014 Posted October 28, 2014 Hello, I am having the same issue. After a couple of tests on my network I found it was the firewall (set differently o different machines). My script basically pings the machine, if it is on/responding (always allowed by all different FW policies) it tries to GetObj. The problem is that some machines have the ports closed by the firewall and others don't. When it connects to a machine with open ports it works like a charm in seconds but when the ports are firewalled it freezes for one minute or so. Hence, same weird randomness of working/failing on similar PCs. I came here looking for an option to set a timeout period but it seems there is no way, OK I'll have to wait for it. But I wanted to post here why it happened here that some computers work and others don't. Sorry for waking up this dead post but I thought the information may come in handy to someone else having this problem now. Another problem is that WMI/DCOM answers on random ports so there is no easy way to tell the firewall what to allow. Workaround: setting a small range for the random ports locally on every machine and setting a firewall rule to allow connection on that range. There is plenty of information on the web about it. AutoIt is a blessing, I don't know how I was able to use my computer before [Auto]It :-S
water Posted October 28, 2014 Posted October 28, 2014 This thread is about 7 1/2 years old. Please do not necro such old threads Please start a new one and link to this one if needed. Windows and AutoIt have changed a lot during this time. So what was true 7 1/2 years ago is not necessarily true today. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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