Simple Package Creation
Simple Package Creation
Create a package for your machine install
Perhaps you have a common collection of applications and settings that you would like to install on any machine you have to work on. You don't want to memorize complicated URLs.
Create and publish a package to create simple Boxstarter URLs!
If you have Chocolatey:
choco install Boxstarter
Otherwise, click on the download link at the top of this page and run the Setup.bat file. See Installing Boxstarter for details.
Create your installer script
Open your favorite text editor and compose your installer. Although this can contain any valid PowerShell, you really do not need to know any PowerShell to create your script. This could just be a collection of Boxstarter commands. Here is an example:
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions Enable-RemoteDesktop Set-StartScreenOptions -EnableBootToDesktop choco install fiddler4 choco install git-credential-winstore choco install console-devel choco install sublimetext2 choco install poshgit choco install dotpeek Install-WindowsUpdate -AcceptEula
These are just Chocolatey Install calls and Boxstarter commands. Save this to a file - name and location do not matter. For a complete list of Boxstarter commands available in a package, see Boxstarter WinConfig Commands and Creating Packages for details covering the creation of Chocolatey packages.
Invoke the Boxstarter shell
The Boxstarter install creates a shortcut to a shell that provides the easiest way to access Boxstarter commands especially if you are not familiar with PowerShell. See Using Boxstarter Commands for information about running Boxstarter in your own shell.
Convert your Script to a Package
Lets assume the script was saved to c:\dev\script.ps1 and I wanted to name my package mwrock.DefaultInstall. Run this command:
New-PackageFromScript -Source c:\dev\script.ps1 -PackageName mwrock.DefaultInstall
This creates a simple Chocolatey package and packs it to a .nupkg file.
Publish the Package
You can publish your package to any feed you have access to. We will publish to the public Chocolatey community feed. To do this you will need to register a free Chocolatey account and obtain an API key.
Once you have a Chocolatey account and have followed the instructions on the Registration confirmation regarding setting your API key, you can use Chocolatey's choco push command to accomplish this:
choco push (Join-Path $Boxstarter.LocalRepo mwrock.DefaultInstall.1.0.0.nupkg)
Boxstarter saves all packages to its LocalRepo property. Now choco push will find the .nupkg file and upload it to the Chocolatey community feed. See Publishing Packagesfor more details regarding package publishing and using different feeds.
Install the Package anywhere
Using IE (or any other browser that has a click-once extension installed) or from a command line (if IE or a click-once enabled browser is your default browser) run:
Accept the prompts for installing the Boxstarter installer and running with administrative privileges. When the install begins, Boxstarter will ask for a password do that it can resume the installer in the event it needs to reboot.