Sign in to follow this  
Followers 0
SBrandon

Creating a loop for a failed application

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

You say you're uninstalling one antivirus application for another. You do realize SCCM is not an antivirus application, right?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0