Everybody knows the pain of installing a complete new PC system. After installing windows and drivers the issue arrises to install all those useful tools like 7zip, VLC media player, Notepad++ and others. You have to download the installers from websites, wait for completion, unzip, run, install and next, next, next.
Linux never had this problem, because of apt-get feature. For Windows there now is a solution: Chocolatey! It offers you a seamless and quiet installation quickly from the command line via a central catalog of installation packages. All you need is the main Chocolatey program installed and the package names you want to install. From the command line, you can install Google Chrome, like this:
That’s it! It tells Chocolatey to download and install Google Chrome.
The real work behind Chocolatey is done by the NuGet program. The developers have created a set of PowerShell scripts around it. Most important: the installers are downloaded from the official sites. Chocolatey is not changing installers, making installers or hosting the installers. It's automating the boring parts of getting software, but it's still getting that software from the same location as always.
First step: install Chocolatey
To install, open a dos prompt and run:
|@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin|
After completion the Chocolatey is downloaded and installed in c:\Chocolatey.
Basic list of commands
All Chocolatey commands are run by the command prompt.
|Full name ||Short name & examples ||Description|
|choco list ||clist ||Display a list of all available packages. |
| ||clist pdf ||Displays only packages with ‘pdf’ in the title/description.|
| ||clist GoogleChrome –all ||Displays all the versions of Google Chrome|
|choco install ||cinst ||Install a package silently. Example: ‘cinst GoogleChrome’.|
| ||cinst –notSilent ||Install a package with the standard wizard. Then more control of where the package is installed & extra options.|
|choco update all ||cup all ||Update all package installed with Chocolatey|
|choco uninstall ||cuninst ||Uninstall a package. Example: ‘cuninst GoogleChrome’|
| || || |
Example of how an installation looks like:
Advanced stuff – your own repository
It’s also possible to create/use your own private repository. It can be a local directory, a USB drive, network share with installers in it. Every installer should have a package install script with the extension .nupkg. You can find them in c:\Chocolatey\lib or you can download them from the Chocolatey website:
You can install local packages by using the –source parameter. For a new computer you can use:
After installation of all the packages, run this to update all:
For the bonus points: Boxstarter offers extra Powershell commands for writing complex installationscripts. Not only for simple Chocolatey packages, but also for installers that require system reboots.
Advanced stuff – Install Windows features
You can also automate installations of Windows features which normally require you to navigate to ‘Add/Remove programs then click Install Windows Features’. To discover the features you can install: ‘clist –source windowsfeatures’.
To install the classic ‘Feature’ Telnet Client, just run: cinst –source windowsfeatures TelnetClient
It’s also possible to install WEBpi features (The Web Platform Installer) like this. Again for a full list: ‘clist -source webpi’. To install Umbraco: ‘cinst –source webpi umbraco’