In this blog post I will explain why to automate installations of Windows applications and how you can do this.
Why automate the installation of applications?
But first, why is this useful? Well this depends on your situation and there are probably many good reasons. For me though, it basically boils down to this:
- I often reinstall my computers with new (preview) versions of Windows operating systems and having to install applications each time is a waste of time. Also sometimes you forget to install some things.
- On a regular basis, friends and family either want me to install or upgrade their PC and I want to provide them with a standard set of programs that most people need/want without having to spend a lot of time on it. By example virus scanner, burning program, media player, codecs, etc.
- I want to update existing installed applications to the latest (and hopefully more secure and feature packed) versions.
- When installing applications, there are often checkboxes enabled to install other applications (you generally don’t want to install). Automated solutions using packages generally prevent these additional unwanted applications from installing.
Which tools to use to automate the installation of applications?
Before PowerShell 5 preview was released, I used both Ninite and Chocolatey to perform to automate installations. They both have their advantages as described on this wiki page.
The PowerShell 5 preview version of OneGet installs and searches software from Chocolatey repositories, but support of additional repositories will come in subsequent versions.
How to automate the installation of applications using PowerShell 5 preview?
To automate the installation of applications a couple of things are required:
- You need to determine which applications you want to install automatically.
- You need to determine the package name that Chocolatey uses for this application. Options include:
-Using a browser to browse the Chocolatey packages
-Using PowerShell and a part of the name of the application you’re looking for. By example if you’re looking for Irfanview, use:
Find-Package -Name “fan”
- Store the package names to install somewhere (e.g. in a .txt file on OneDrive for easy access). My .txt file by example includes:
- Use the Install-Package cmdlet to install all the packages whose name is in the file from step 3.
Install-Package -Name (Get-Content C:\OneDrive\AppsToInstall.txt) -Confirm:$False
- Wait for the programs to install
It’s great to be able to use PowerShell to install my list of favorite applications similar to like I did with Chocolatey and I’m also looking forward to see what benefits the additional repositories will bring in the future.
I did encounter some errors however while trying to install some applications like Firefox and dotnet3.5. But since it’s still a preview, this will probably be fixed.
For regular users, I think they are better off sticking to by example Ninite because they’re often afraid of anything that involves a CLI.
Blog posts by other people about OneGet
Some other people have also blogged about the OneGet module and have gone in more technical detail, so be sure to take a look at their posts as well:
More information about PowerShell 5 Preview including a download link
Windows Management Framework v5 preview, includes also Desired State Configuration (DSC) improvements and NetworkSwitch commandlets to manage network switches that pass the Certified for Windows Program. For more information including a download link, you can read the initial blog post. : Windows Management Framework V5 Preview