Automate the installation of applications
Do you have to manage more and more computers within your environment? Does it become (nearly) impossible to manage them manually, especially keeping them up to date with the software installed on them? Automated installation of software will give you many benefits, to name some:
- Reduce amount of manual operation will reduce human error
- Fasten the deployment
- Protecting you against known security risks
- Augmenting user satisfaction as they can use software that is more up to date
Having some difficulties automating the installation of applications?
There are several ways to script an application; I will explain how to find specific commands and how to create an automated installation script.
Executables (.exe) and MSI-files are the most common files you will find when you want to install a software.
For our example, I will create a batch file (.bat) which will install an application in an automated way. The commands/syntax in there could be used in other files or scripts to achieve the same.
Creating your automated deployment file
As an example, we will use the ‘Check_MK’ Agent.
1. Download the source from the internet (if you would not have it yet from prior manual installations). Make sure your content is in a specific folder for the test.
In our example, I created a ‘Test’ Folder into C:\ and then Check_MK folder.
2. Open the command prompt by clicking on windows menu key of your keyboard and search for ‘cmd’. Right click on Command Prompt and ‘Run as administrator’ is the better option to make sure you can do everything you need.
You now need to go to the source folder first. You use “cd” (which is the command to go into a folder) and then you put the source path.
You can see what is in there with “dir” command and see your sources:
Now you execute your MSI file and add ‘ /?’ just after it.
A popup window appears revealing all the parameters you can add when launching your MSI file. ‘/?’ means help.
This will help you creating your automated script. For sure we can use ‘/quiet’ parameter on client PC’s, which will do a silent installation, not disturbing the end-user. No prompts will be given.
3. Let us now create our batch file (.bat)
Open a text editor such as Notepad and type the name of your setup file and add ‘/quiet’ after it.
Save it as install.bat into the source’s folder.
Now you are ready: you can execute the install.bat file with sufficient rights and it will install in this case the Check_MK agent without anything prompt or manual further action.
Check_MK is now installed and you can verify it by looking in Apps & Features.
For about 10% of the applications, we do not have /? option.
We need to find out in the documentation or by ourselves for those.
It sometimes is /quiet (or /silent) for .exe files.
4. You can do the same for uninstallation: do it in an automated way.
The uninstallation commands are stored into your registry.
Open registry as administrator and go to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
Search for your application name (Check_Mk in our example) and you will have all the information you need.
You have a value called “UninstallString”: this is the command you can use to uninstall the application.
Copy/paste it into a new notepad file, add /quiet just next to it and save as uninstall.bat .
Now run it as administrator and your application is completely and automatically removed.
Take the time to create a script and you will be able install applications swiftly and in exactly the same manner on every device. If you use a Systems Management Tool such as Microsoft SCCM (System Center Configuration manager), you can now start scheduling deployments, add conditions for the deployment and so on. Note that this can be done for off the shelve applications as well as in-house developed ones.