I recently used Boxstarter to set my development machine back up after a format.  Boxstarter is a game-changer for Windows.  I create a simple Powershell script, ran a simple command, then walked away as my machine spent the next several hours downloading, installing, and rebooting, all without me lifting another finger.  When the dust settled, I had a Windows 8.1 machine with my tools and utilities installed, updated, and ready to rock.

[more]

What is Boxstarter?

In its own words: "Repeatable, reboot resilient windows environment installations made easy using Chocolatey packages. "  It can do remote machines, too, though I haven’t messed with that. 

Chocolatey?

The magic under the hood is Chocolatey, which is really worthy of a blog post all on its own.  Think of Chocolately as apt-get for Windows: you run a simple Powershell command, like ‘cinst googlechrome,’ and Chocolatey finds the package, downloads it, and silently installs it. I had a pretty negative experience with Chocolatey the first time I tried to use it back in the day, but now, it’s a great tool, and I typically check there first when I need to install something.  I still find the rare package that doesn’t install correctly, but at this point I blame the package author when that happens rather than the tooling itself.

The Boxstarter Script

When it came time to format my machine, I started by creating a list of the apps I wanted to have available.  This list included utilities like Dropbox, Console2, LogMeIn, etc, and also developer tools like Visual Studio (2012 and 2013), Notepad++, etc.  From this list, I then searched Chocolatey.org to find the corresponding package.  I created a Powershell script, and started pasting in the ‘cinst’ commands for the packages I wanted.  Here’s what I had so far:

cinst GoogleChrome
cinst notepadplusplus.install
cinst VisualStudio2012Professional
cinst VisualStudio2013Professional
cinst resharper
cinst Console2
cinst tweetdeck
cinst Logmein.Client
cinst VirtualCloneDrive
cinst dropbox
cinst CrashPlan
cinst steam
cinst keepassx
cinst AdobeAIR
cinst PDFXChangeViewer
cinst 7zip.install
cinst Evernote5
cinst WindowsLiveWriter
cinst skype
cinst mp3tag
cinst Pencil
cinst origin
cinst teamviewer
cinst filezilla

Next, I added in some Boxstarter-specific commands.  At the top of my script, I used Boxstarter to configure Windows explorer with "Show File Extensions" and "Show Hidden Files, Folders & Drives" already enabled.  I also used a Boxstarter command to enable Remote Desktop.  Finally, I again used Boxstarter to call Windows Update both before my main package installation block and after, that way any needed Windows Updates would be installed for me.  As a final measure, I used Chocolatey’s "windowsFeatures" source to install the IIS-WebServerRole.  Here’s what my final script looked like:

Set-ExplorerOptions -showHidenFilesFoldersDrives -showFileExtensions
Enable-RemoteDesktop
cinst IIS-WebServerRole -source windowsfeatures
Install-WindowsUpdate -acceptEula
 
cinst GoogleChrome
cinst notepadplusplus.install
cinst VisualStudio2012Professional
cinst VisualStudio2013Professional
cinst resharper
cinst Console2
cinst tweetdeck
cinst Logmein.Client
cinst VirtualCloneDrive
cinst dropbox
cinst CrashPlan
cinst steam
cinst keepassx
cinst AdobeAIR
cinst PDFXChangeViewer
cinst 7zip.install
cinst Evernote5
cinst WindowsLiveWriter
cinst skype
cinst mp3tag
cinst Pencil
cinst origin
cinst teamviewer
cinst filezilla
 
Install-WindowsUpdate -acceptEula
 
<#
Manually install:
Balsamiq mockups
SSMS 2012
Google Music Manager
Camtasia Studio
Office
Pomodairo
Git Extensions
WebMatrix
#>

Notice that I left a list of apps to install manually at the end.  This served as a reminder to me to go back and download this smattering of things manually later on since they either a) aren’t available on Chocolatey or b) aren’t packaged with the options I like to use. 

With the script in place, I created a gist on Github, and pasted my script there, like so.

Running the Boxstarter Script

There are a couple of ways to run Boxstarter, but I opted for the web-based installation method.  Assuming you have your Boxstarter script available online (like the gist above!), you can invoke the web-based installer, which is a ClickOnce application, by going to this URL in Internet Explorer: http://boxstarter.org/package/nr/url?HTTPS://URL_TO_YOUR_SCRIPT.  Getting the path to your script is a bit tricky if you are using a gist, but as described in the docs, you can click the "Raw" button for your gist, then feed that URL to Boxstarter.  For me, this gave me a URL of  http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/MattHoneycutt/eb8869c5c51abf88849f/raw/5ebd486142bfe28710736b515173b29de1d0a1c4/Dev-BoxStarter.txt.  When I ran that in Internet Explorer, I received the familiar ClickOnce prompt…

image

I clicked "Ok," then it was off to the races! 

Just to recap, if you want to use Boxstarter, here’s what you need to do:

  1. Create a Boxstarter script of the apps and options you want on your new machine.
  2. Install (or re-install) Windows.  No need to install updates, Boxstarter can do that.
  3. Run the web-based installer, and launch the ClickOnce application.
  4. Go do something useful while your fresh copy of Windows is prepared for you.

The next time you are building or rebuilding a machine, I highly recommend you check it out!