Monday, April 11, 2016

Rapidly Setting Up an Azure PC with Chocolatey

Azure is a great platform.  It is easy to spin up developer and test machines.  Microsoft has default installs of Visual Studio but there is currently no way to select other software.  Silent installs are nothing new but Chocolatey takes it a step further to be a distribution point of installers.  Think of Chocolatey as NuGet but with applications instead.  With Chocolatey and Azure you can rapidly install the software that you need to work effectively.  This also works great if you purchase a new PC or laptop or decide to Nuke and Pave a machine.   
    

To install Chocolatey open an admin command window and execute this statement:

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin


To make installing applications easier with Chocolately, I created a batch file to be called by a parent batch file called InstallApp.bat.  It has standard parameters of -y which is to accept all defaults.

cinst %1 -y --allow-empty-checksums


I then created the parent batch file with a list of the applications I wanted to install before installing Visual Studio.  If Visual Studio is already pre-installed on an Azure machine you can simply create one big batch file.

REM Media
call InstallApp paint.net
call InstallApp foxitreader
call InstallApp cutepdf
call InstallApp evernote
call InstallApp imgburn
call InstallApp zim
call InstallApp anyvideoconverter
call InstallApp notepadplusplus.install
call InstallApp picpick.portable
call InstallApp todoist

REM Web
call InstallApp firefox
call InstallApp googlechrome
call InstallApp flashplayerplugin
call InstallApp skype
call InstallApp teamviewer

REM Utilities
call InstallApp 7zip.install
call InstallApp filezilla
call InstallApp chocolateygui
call InstallApp winmerge
call InstallApp virtualclonedrive
call InstallApp beyondcompare
call InstallApp roboform
call InstallApp javaruntime
call InstallApp truecrypt
call InstallApp windirstat

REM Developer Tools before Visual Studio
call InstallApp tortoisesvn
call InstallApp expresso
call InstallApp ilspy
call InstallApp sliksvn
call InstallApp git.install
call InstallApp tortoisegit
call InstallApp visualstudiocode
call InstallApp baretail
call InstallApp nunit
call InstallApp httrack
call InstallApp xenulinksleuth
After installing Visual Studio I have a set of applications that I like to install:

REM Install After Visual Studio is Installed
call InstallApp visualsvn
call InstallApp resharper-platform
call InstallApp mono


That’s it.  Simply run the batch file and all the software that you need will be downloaded and installed without intervention.  Come back later and your PC will be ready.

1 comment:

  1. I would recommend to integrate this with BoxStarter. I create raw script for cinst commands under Gist and then URL accessible file is then loaded through BoxStarter URL, http://boxstarter.org/WebLauncher.

    ReplyDelete