First import modules in admin powershell

Import-Module Boxstarter.Chocolatey

Create a power shell script

Install-WindowsUpdate -acceptEula -getUpdatesFromMS
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Set-TaskbarOptions -Size Small -Dock Bottom -Lock

Allow running PowerShell scripts

Update-ExecutionPolicy Unrestricted

Disable System Restore

disable-computerrestore -drive "C:\"

Disable hibernate

powershell -Command "Start-Process 'powercfg.exe' -Verb runAs -ArgumentList '/h off'"
if (Test-PendingReboot) { Invoke-Reboot }

Install chocolatey packages

choco install spotify
choco install dotnet3.5
choco install imdisk
if (Test-PendingReboot) { Invoke-Reboot }

Now yout can create a packge from script

New-PackageFromScript MyScript.ps1 "Dev-Boxstarter"

This will create a nuget package in local repository, see variable $Boxstarter.LocalRepo

Package with contents You can create package with contents to copy later. In this, I have in my-files folder, a .gitconfig file.

New-BoxstarterPackage -Name "Dev-Boxstarter" -Description "Sample box" -Path "C\my-files"

Later, in your script you can usage this command to copy files:

Copy-Item (Join-Path -Path (Get-PackageRoot($MyInvocation)) -ChildPath '.gitconfig') -Force $env:USERPROFILER\.gitconfig

Customize scripts After execute New-BoxstarterPackage, a nuget package will be create in $Boxstarter.LocalRepo folder. Lets open Dev-Boxstarter\tools\ChocolateyInstall.ps1.

Lets add first script created in this new file.

Generate package After finish configure scripts and files, we can make a nuget package:

Invoke-BoxstarterBuild "Dev-Boxstarter"
$files = Join-Path -Path $pwd.Path -ChildPath "content"
New-BoxstarterPackage -Name "Dev-Boxstarter" -Description "A box for .net developers" -path $files

Publish package

The first thing you mey now is that Boxstarte look for package in onrder: Local, Chocolatey feed, Boxstarter Community Feed (hosted in MyGet), the first package with same name finded, will be use.

You can define sources like this:

Set-BoxstarterConfig -LocalRepo "\\server\share\myRepo"

or

Set-BoxstarterConfig -NugetSources "http://www.myget.org/F/MyNugetFeed/api/v2;http://chocolatey.org/api/v2;http://www.myget.org/F/boxstarter/api/v2"

Myget for push package

We use a default community Boxstarter in MyGet to push our package. First we need a accesstoken to push our package:

After sign up, get you access token in your profile on MyGet.

nuget push SamplePackage.1.0.0.nupkg f1258b54-8143-4237-bc1a-89e14c3ab933 -Source https://www.myget.org/F/boxstarter/

Install package

Boxstarter use a ClickOnce installation, this mens you can simple navigate a URl e all is good!

START http://boxstarter.org/package/mwrock.DefaultInstall
ridermansb-devbox.boxstarte

$cred=Get-Credential
Install-BoxstarterPackage -PackageName "Dev-Boxstarter" -Credential $cred

Sample

I create a gist for my envairoments