Box

In The Beginning, There Was Boxstarter

Recently, I did something dumb that completely hosed my developer machine at home. After agonizing over my stupidity, I decided this was a great opportunity to start from scratch and rebuild my box with a couple tools I’ve been drooling over the past year: Chocolatey and Boxstarter. I’m not going to spend a lot of time telling you what they are because Rob Reynolds and Matt Wrock have already done a great job documenting them. I’ve reached a point in life where I don’t want to download-click-next-finish my way through a bunch of mindless installs. I’d rather have something repeatable that does the work for me because I will inevitably do something moronic like this again. So, let’s make things better.

Here are my requirements:

  • Basic Windows 8.1 install
  • Visual Studio 2013 development environment
  • SQL Server development environment
  • All my favorite tools and Visual Studio extensions
  • Make it modular
  • Make it evolvable

Basically, I want to kick this off, go to bed and awaken to a fresh, clean box ready for development and maybe some Battlefield 4. Here’s what you do:

Step 1: Cut a hole in the Box

cut-a-hole-in-the-box

Ok, time to start over. If you don’t have one already, I highly recommend creating  a bootable USB Windows 8.1 drive. I keep mine stored out on OneDrive for situations like this. Important safety tip Egon: Most USB drives are formatted as NTFS and that won’t work for a UEFI system. You’ll want to format that as FAT32.  I booted from the USB drive, deleted my partition and installed a fresh, clean Windows 8.1.  Then, I added the machine to my domain and linked my Microsoft account to my Windows login. I do that to sync my settings, store apps, OneDrive, etc…

Step 2: Put your junk in that Box

Here’s where things get fun. Between Chocolatey packages & commands and Boxstarter commands, you can install almost everything you need. For advanced machine configuration, or simply showing off, some Powershell knowledge will go a long way. I merely dabble and my scripts reflect that. Once I found the packages I wanted, I created a Gist on GitHub.  I broke my scripts down into 4 main areas so I can evolve them as my environment changes:

Most of this is pretty straightforward. One thing you will notice is that I create a Desktop Shortcuts folder and pin it to my task bar. I put a lot of my daily use application shortcuts in a OneDrive folder and keep that consistent across all my machines. This is a great place to right-click each shortcut and set to “Run as Administrator” so that you only have to do this once.

Step 3: Then you open the Box

Before I ran this script on my machine, I spun up a few VM instances in Azure to make sure everything installed successfully. I have free credits with my MSDN subscription so that was a no brainer. If you have MSDN, I highly recommend activating your Azure account; it’s a great benefit!

From here you could take your Gist and turn it into a Boxstarter package, but for my situation, it didn’t make sense. If I ever need to manage an army of VMs with multiple configurations, then I might, but a simple Gist was all I needed.

Here’s the gorgeous part: from a clean Windows 8.1 install, all I had to do was fire up Internet Explorer and run my Gist.

START http://boxstarter.org/package/nr/url?https://gist.githubusercontent.com/mwhisler/80b97cb9b5e180e5b4e2/raw/5568f0fe586bc4b018e1b473969696a759c924ec/development

Boxstarter will automatically install Chocolatey, create a Boxstarter package and begin execution. It will ask for your Windows login & password so it can write the reset file and handle the reboots. After that, sit back and enjoy the magic.

That’s it, my friends. Now I’ve got a repeatable install script that I can use to quickly bring my machine back to life whenever bad things (stupid things) happen. It’s also something I can evolve as my development needs change. Another win. Plus, the unattended installation allows me to focus on this Game of Thrones episode. I’m going to need extra focus if I’m ever going to learn everyone’s name.

Now, go make things better.

Next ArticleHow Big Data Will Change Your Life