SBrandon Posted January 26, 2015 Share Posted January 26, 2015 I am pretty rusty using AutoIT. I love it but with my job I haven't used it in a number of years. What I am trying to do, and I may be going about it all wrong, is re-run an application installation from a command prompt if it fails the first time. Here is the scenario: I am currently writing a script to remove one antivirus program and install another in a business info structure. I have the script working perfectly minus one issue. On a couple of systems in the 30 that I have tested, when I run that application that removes it, it fails. If I rerun the removal tool a second time it works. What I need to work into the script is some way to detect the removal tool failing and then have it re-run it a second time then continue the rest of the script. I would post the scripts I have tried but at this point I wouldn’t know which one to even post. This is the latest attempt at a working loop but it doesn't work either. I have driven myself nuts over this for the past week and any help would be greatly appreciated. While 1 $var_5 = ControlGetText("ccmclean (v2.50.3025.1000)", "Your system has been successfully cleaned.", 2) Sleep(1000) If $var_5 = "OK" Then WinClose("[CLASS:ccmclean (v2.50.3025.1000)]") Sleep(500) ElseIf $var_5 = ControlGetText("ccmclean (v2.50.3025.1000)", "Failed to remove product Configuration Manager Client (1618)", 2) Then WinClose("[CLASS:ccmclean (v2.50.3025.1000)]") Sleep(500) Run('cmd') _WinWaitActivate("Administrator: C:\Windows\System32\cmd.exe", "") Send("p{SHIFTDOWN};{SHIFTUP}{ENTER}cd{SPACE}x64{ENTER}ccmclean.exe{SPACE}/client{ENTER}") Send("exit{ENTER}") WinClose("[CLASS:ccmclean (v2.50.3025.1000)]") ExitLoop EndIf WEnd Link to comment Share on other sites More sharing options...
JohnOne Posted January 26, 2015 Share Posted January 26, 2015 "It does not work" is not enough to go on, need specific details of the exact thing which goes wrong. I think though that an If Elseif needs an Else keyword. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
SBrandon Posted January 31, 2015 Author Share Posted January 31, 2015 Thanks for the response. I ended up taking out the loop all together and just having it load a vb script to remove sccm. That fixed my problem with sccmclean failing to remove the application. Still running into an issue with Forefront not wanting to uninstall but that is a seperate issue all together. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 31, 2015 Moderators Share Posted January 31, 2015 You say you're uninstalling one antivirus application for another. You do realize SCCM is not an antivirus application, right? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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