Day 4: Automating Application Installation Using PowerShell Without DSC or OneGet

Welcome to Day 4 of the “100 Days of DevOps with PowerShell”! For background on our goals in this series, see Announcing the “100 Days of DevOps with Powershell” Series here at SCC.

One of the major features of PowerShell 5.0 is the ability to discover and install application packages from web-based repositories using the OneGet module. I’m not going to go into how to use OneGet here. That will come in a future article. However, it’s worth exploring alternatives to OneGet, because for some environments there isn’t the option to install PowerShell 5.0 or even PowerShell 4.0. Bear in mind the vast majority of real-world environments do not upgrade their production operating systems with anything like Microsoft’s release cycle. I still meet customers who are provisioning Windows Server 2008 R2 as their production server operating system and are in the midst of rolling out Windows 7! These operating systems are already two versions behind and with Microsoft’s increased release cadence, this gap is only going to get bigger.

The need for DevOps (automation, standardized configuration, continuous release) doesn’t go away just because you are not running the latest version of Windows…it just requires a bit more creativity.

Options when OneGet and DSC are not options

So if you are not running the Windows 8.1 or Windows Server 2012 R2, what options do you have to automate the installation of packages?

Ninite – ( allows you to select the applications you want via its website and then provides you with a single installer that will install all the applications. While the applications are reliably packaged in that they install silently and with the appropriate platform, you are limited by the applications available on Ninite and you cannot easily automate the selection of the applications. Although if you selected PuTTy, Notepad++ and 7-Zip you could use the following for the downloaded installer in PowerShell:

& ‘Ninite 7Zip Notepad PuTTY Installer.exe’

Chocolatey – ( Chocolatey is a NuGet-based package manager that allows you to search and download packages from the Chocolatey repository. There are many more applications available on Chocolatey than on Ninite and most importantly, and unlike Ninite, it’s PowerShell based and therefore scriptable. It can be installed with a one-liner that automatically downloads and runs the installer script.

Searching and Installing Packages

Once installed, you have Chocolatey commands available to search for and install applications. For example, to search for Putty:

Chocolately list putty

and it will return the following:


(NOTE: to abbreviate even further you can use either  choco list putty  or even clist putty)

The key here is that you need to find the package name. Once you have determined the package names we can put them into an array and install them:

$packages = @(‘notepadplusplus’, ‘putty’, ‘7zip’)
$packages | foreach {chocolatey install $_}

Once you have the names of the packages you want to install and use the snippet above, Chocolatey will take of the rest, including the silent installations and any dependencies the packages may require.

Just use PowerShell – If Ninite is not suitable or your corporate policies do not allow the installation of packages from third party repositories, then you can of course just use PowerShell to do the download and installation on your behalf. The snippet below is based on code borrowed from my colleague, Joe Thompson. In the hash table below we store the direct URL of the package, the download location and the parameters required to perform a silent installation:

The script can of course be modified to account for applications that reside on your own file shares. And if you want to take things even further, store the hash table in a database on a SQL server and you have the beginnings of your own software repository.


Sometimes you don’t have the latest and greatest versions of PowerShell available, so when OneGet or DSC are not an option, it’s useful to know what you can use instead.

Are you running in an environment without Windows 2012? How are you enabling DevOps? I’d love to hear about your creative solutions in the Comments section below.

Previous Installments

Below are previous installments in the “100 Days of DevOps with PowerShell” series.

Day 3: PowerShell and Team Foundation Server 2013 – Getting Started

Day 2: How to install DSC Providers for Linux on CentOS 6.2

Day 1: Intro to PowerShell DSC and Configuring Your First Pull Server

Announcing the “100 Days of DevOps with PowerShell” Series

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.