Boxstarter or better option

May 1, 2014 at 2:40 AM
We are getting a new set of laptops for our development team and I would like to have a standardized way to set them up. We use VS2013 Premier and SQL Server 2012 Developer Edition and a few other software packages (such as ReSharper, etc). I have all the ISO files extracted on an external drive and I would like to build a script of some sort to install all the apps we need. Is it possible to get them to run one after the other via a script? Is Boxstarter the best way to handle something like this or is it doable through Powershell? Thanks for any help you can give.
May 1, 2014 at 6:04 AM
With VS and SQL together, the chances are strong that reboots will be required and Boxstarter will help you out there. It can also do things like install windows updates which can incur several more reboots. Given the fact that you have the software on an external drive, you can create packages that install the bits from this location. For example, your sql server install script might look like:
try {
    if(Test-Path "HKLM:\Software\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion"){
        if((Get-ItemProperty -Path HKLM:\Software\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion).CurrentVersion -ge "11.0.3000.0") {
            Write-Host "Sql 2012 SP1 already installed"
    else {
        $adminsGroupName = (New-Object Security.Principal.SecurityIdentifier 'S-1-5-32-544').Translate([Security.Principal.NTAccount]).Value
        $currentUser = Get-CurrentUser
        Install-ChocolateyInstallPackage 'Sql2012' 'exe' "/q /INDICATEPROGRESS /ACTION=Install /FEATURES=SQLEngine,FullText,ADV_SSMS /TCPENABLED=1 /INSTANCENAME=MSSQLSERVER /SQLSVCACCOUNT=`"NT AUTHORITY\Network Service`" /SQLSYSADMINACCOUNTS=`"$adminsGroupName`" `"$($currentUser.Domain)\$($currentUser.Name)`" /AGTSVCACCOUNT=`"NT AUTHORITY\Network Service`" /IACCEPTSQLSERVERLICENSETERMS " '\\External\Share\SQL Server 2012 SP1\Developer\X64\setup.exe' @(0,3010)
        netsh advfirewall firewall add rule name="allow access to sql" Dir=In Action=allow Protocol=tcp LocalPort=1433 Profile=Domain

        Write-ChocolateySuccess 'Sql2012'        
catch {
  Write-ChocolateyFailure 'Sql2012' $($_.Exception.Message)
Lets assume that script was saved i a file called c:\dev\sql.ps1. You could run:
New-PackageFromScript -Source c:\dev\sql.ps1 -PackageName SqlServer
This would create a package in $boxstarter.LocalRepo.

You may want to relocate the Boxstarter root directory ($Boxstarter.BaseDir) to another share. Lets say you did that and you had another package that looked something like:
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles -showFileExtensions
Set-StartScreenOptions -EnableBootToDesktop
cinst VisualStudio
cinst sql
cinst resharper
Install-WindowsUpdate -AcceptEula
This is the package that users would run to include all the other packages. Assuming this package was named FullDevInstall and users had read access to the boxstarter share, users could run:
\\server\share\boxstarter.bat FullDevInstall
This bat file invokes boxstarter allowing users to call it from either PowerShell or cmd.exe and boxstarter will look for packages stored in your private boxstarter repo before scanning the public chocolatey feed.
May 2, 2014 at 4:27 AM
Thank you for the feedback. I'm unfamiliar with some of what you are trying to do in your examples. Looks like some of the examples are in Powershell and others in Boxstarter or Chocolatey. Where is the best place to get started learning more about the different pieces and how they work together? Thanks
May 3, 2014 at 4:38 AM
"Technically" it is all powershell but it can certainly be unclear the context where each piece runs. The best place to get up to speed on how all the pieces come together is the Learn and Docs sections of
May 15, 2014 at 9:46 PM
I have a better understanding of how everything works now but I still have a couple of questions.

I have all the ISO file extracted to a USB drive. Here is what I have come up with so far.
  • Create a script for each application I want to install
    • VS2013 Premium, SQL 2012, etc
  • Create a Boxstarter package for each script file
  • Create a main package that will call all the custom packages and any Chocolatey packages I want
  • Call main package via boxstarter.bat
That all makes sense to me. However, I'm still confused on what $boxstarter.LocalRepo & $Boxstarter.BaseDir do for me. Can you help calrify that for me? Thanks.
May 15, 2014 at 10:05 PM
One more question. Do you have a script file like the SQL one above for Visual Studio 2013? I'm guessing it would use the syntax for a silent install of VS, right?
May 16, 2014 at 12:16 PM

With regard to the LocalRepo, have a look here:

If you use some of the Boxstarter Helper Commands to create a Chocolatey Package, the local repo is where the templated package will be created. In addition, when installing using the Helper Commands, Boxstarter will look for the specified package name in this location, before going out to the defined Repo Locations.

BaseDir is simply the location that all the Boxstarter files are located.

You can download Matt's Visual Studio 2013 Chocolatey Package from here:

Once you have it downloaded, you can use the Nuget Package Explorer, or simply extract the files, to look at the ChocolateyInstall.ps1 to see how it is done. From there, you should be able to create a custom Chocolatey Package that does the same work using the locally downloaded version.

Hope that helps!