Multiple installations Scripting

Installing and updating software on computers can be a tedious task. Especially if you have to reinstall Windows frequently on one or more machines. In this article, we will look at how you can automate the process of installing multiple applications using Multiple installations Scripting: PowerShell, Winget, Patch files, Chocolatey and so on. In addition, we will show you how you can use the console tool to make the installation process easier and faster.

Batch files are a trivial solution  

To begin with, let’s analyze a trivial solution in the form of Batch-files install Script.
Batch files are command line scripts in Windows family operating systems. They allow you to execute a series of commands in the Windows shell in order. Batch files can be used to automate a variety of tasks, including installing applications. Here are some features and examples of usage. A Batch file is a text file with a .bat format.

Installing applications: You can use Batch files to install applications, for example, using the msiexec command for MSI packages. Here is an example Batch file to install two applications:

batch code


@echo off
echo Installing Application 1...
msiexec /i "C:\Path\To\App1.msi" /qn
echo Application 1 is installed.
echo Installing Application 2...
msiexec /i "C:\Path\To\App2.msi" /qn
echo Application 2 is installed

Pros:

  • Simplicity: Batch files are easy to create and understand, and can be created with a text editor.
  • Flexibility: You can execute any commands and scripts in Batch files, making them flexible for a variety of tasks, including installing applications.
  • Local execution: Batch files can be run locally on a computer without the need to install additional tools.

Cons:

  • No central management: Batch files do not allow you to configure and monitor program installations on many PCs.
  • Limited dependency support: You must manually manage dependencies and application updates.

The most popular install Script tools:

Chocolatey is a package manager for Windows that provides a simple and automated way to install, update and manage applications.  Chocolatey is installed on your computer using a PowerShell command. 

It allows you to:
Install applications from the Chocolatey repository using the choco install command.
Create your own Chocolatey packages to install your own or corporate applications.
Chocolatey is especially useful in corporate environments where you need to ensure that software is consistent and up-to-date across multiple computers

powershell code



Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex
((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco install firefox notepadplusplus googlechrome

Pros:

  • Convenience and Automation: Chocolatey provides a convenient and automated way to install and manage applications, including its cooperative repositories easily managed through console commands. 

Cons:

  • Chocolatey Installation Required: To use Chocolatey, you must install it on your computer. This may require additional permissions and access rights.
  • Chocolatey has limited customization and application selection options, and you may need to create your own Chocolatey packages for more complex cases.

New solution-Installation with Winget:

Winget is a console tool from Microsoft that allows you to install applications from the Microsoft catalog with a few commands. To use Winget, you need the Microsoft Application Installer, which you can download from the Microsoft Store.

You can then write a PowerShell script that automates the installation of multiple applications. In this script, you create a list of applications that you want to install and check to see if they are on your computer. If an application is not installed, you use Winget to install it.

PowerShell script to install applications using Winget

powershell code




$apps = @(
    @{name = "7zip.7zip" }
    @{name = "Adobe.Acrobat.Reader.64-bit version" },
    # Add any other applications you want to install here
)
Foreach ($app in $apps) {
    $listApp = winget list --exact -q $app.name
    If (![String]::Join("", $listApp).Contains($app.name)) {
        Write-Host "Install: " $app.name
        winget install -e -h --accept-source-agreements --accept-package-agreements --id $app.name  
    }
    else {
        Write-Host "Skip: " $app.name " (already installed)"
    }
}

Run this script as administrator and it will automatically install any specified applications that are not already installed on your computer.

Silent Install Builder:

Silent Install Builder is an advanced tool for creating and deploying software packages on Windows. It allows you to: Create packages containing multiple installers of different types (InstallShield, MSI, NSIS, etc.) and run them with a single click. Automate the installation of applications that do not support silent installation by writing UI Automation scripts. Use scripts in JavaScript, PowerShell, cmd, vbs and other languages to define installation conditions, modify files and registry. Create both .exe and .msi packages for deployment in an enterprise environment using GPO, SCCM, Intune or other tools.

Pros: 

Flexibility and functionality: Silent Install Builder allows you to customize various installation settings and options, and use scripts to perform additional actions. Support for different installer types: Silent Install Builder automatically detects the installer type and command keys for silent installation. 

Ability to create both .exe and .msi packages: Silent Install Builder allows you to choose the package format depending on your deployment goals.

Cons: 

Difficult to use and learn: Silent Install Builder requires some knowledge and skills to create packages, especially if scripts and UI Automation are used.

Automated solutions for regular users:

Ninite is a simple tool for installing and updating applications on Windows. It allows you to:

Select multiple applications from a list and create a single installation file.
Automatically update installed applications.

Pros:

  • Easy to use and update: Ninite makes it easy to install and automatically update several popular applications at the same time.
  • Install apps without unwanted additional programs.
  • Optimized app selection and installation: Ninite offers a centralized list of apps that you can select and install without additional customizations.

Cons:

  • Limited app selection
  • Limited Customizations: You can’t customize additional installation settings or options, as is often the case with more complex apps.

Scoop:

This is a free program that allows you to install applications using the command line. It has over 5,000 packages that can be installed using the command line 

Homebrew: 

This is a free program that allows you to install applications on your Mac. It has over 4,000 packages that can be installed using the command line

Previous article: How to install a GPO.
See also:

Silent Install Builder 6 Documentation

How to deploy an exe-file using Group Policy (exe to gpo)

Other software at apreltech.com