AutoIt - Last Resort for Silencing Application Installations

August 17, 2015

I was recently given a task during a large migration from Novell to Active Directory – remove the Novell Client for Windows from the OS (Windows XP and Windows 7). If anyone has every tried to do this, they'll know that this process is not something that can be easily automated. There is no simple uninstall command that can be completely supressed. The best thing I could come up with was a script that identified which OS and which version of Novell Client for Windows was installed, and then called the proper uninstaller. However, at this point, there are two prompts that need user-interaction.

Short of having people run out and click the appropriate answers on these prompts, I was at a loss of how to supress these prompts. Then I found a script handler called AutoIt. AutoIt is a script-based program that can send keyboard-commands to the system in order to handle GUI-based installations/configurations. I'll show you the script, and then we can talk about it:


; Run the Novell Client uninstall from commandline
Run("CSCRIPT.EXE RemoveNovell.vbs")

; Wait for message box to become active
WinWaitActive("Uninstall Novell Client for Windows")

; We are sure we want to uninstall, so we tell AutoIt to press "enter"
Send ("{ENTER}")

; Again, we wait for the reboot prompt here
WinWaitActive("Uninstall Novell Client for Windows")

; Send the command ALT+N to say No to the reboot so we can continue with other batch processing
Send("!n")

; Finished!

 

All pieces of this script are pretty self-explanitory if you're familiar with writing batch files and other scripting languages. Basically, it launches my method of uninstalling the client, then waits for the first window with a specified title. It presses Enter to default "Yes" on the first prompt. Then it goes back into a waiting mode for the next prompt, to which I tell it to press "Alt+N" to say "No" to the reboot prompt. The script knows when to execute the proper keyboard-commands based on the title of the window. I'm not an AutoIt expert, but I managed to get this working which excites me more than anything else this week. Beyond that, I'd have to Google Bing search for answers or other commands that can be used for GUI-interaction.

The best part about AutoIt is that the script you create to automate all these tasks can be compiled into an executable. This will allow you to generate an executable to do all this legwork so you don't have to worry about setting any type of execution policies (Powershell) or explain to people how to execute said script, since it's all compiled into the executable.

As you may have guessed, I packaged this into an SCCM package and was able to successfully deliver it to my pilot group thus far to ensure compatibility and functionality. I did, however, have to specify that the package must run with administrative rights and can interact with the user. This allowed the popup windows to be visible, which allows AutoIt to manage the prompts.

Link to AutoIt: https://www.autoitscript.com/site/autoit/downloads/

Information and material in our blog posts are provided "as is" with no warranties either expressed or implied. Each post is an individual expression of our Sparkies. Should you identify any such content that is harmful, malicious, sensitive or unnecessary, please contact marketing@sparkhound.com.

Meet Sparkhound

Review our capabilities and services, meet the leadership team, see our valued partnerships, and read about the hardware we've earned.

Learn How We Work

See how our Plan/Build/Run methodology drives real client success, and gain our team's perspectives on timely tech topics.

Engage With Us

Get in touch any of our offices, or checkout our open career positions and consider joining Sparkhound's dynamic team.