Unpacking Software Livestream

Join our monthly Unpacking Software livestream to hear about the latest news, chat and opinion on packaging, software deployment and lifecycle management!

Learn More

Chocolatey Product Spotlight

Join the Chocolatey Team on our regular monthly stream where we put a spotlight on the most recent Chocolatey product releases. You'll have a chance to have your questions answered in a live Ask Me Anything format.

Learn More

Chocolatey Coding Livestream

Join us for the Chocolatey Coding Livestream, where members of our team dive into the heart of open source development by coding live on various Chocolatey projects. Tune in to witness real-time coding, ask questions, and gain insights into the world of package management. Don't miss this opportunity to engage with our team and contribute to the future of Chocolatey!

Learn More

Calling All Chocolatiers! Whipping Up Windows Automation with Chocolatey Central Management

Webinar from
Wednesday, 17 January 2024

We are delighted to announce the release of Chocolatey Central Management v0.12.0, featuring seamless Deployment Plan creation, time-saving duplications, insightful Group Details, an upgraded Dashboard, bug fixes, user interface polishing, and refined documentation. As an added bonus we'll have members of our Solutions Engineering team on-hand to dive into some interesting ways you can leverage the new features available!

Watch On-Demand
Chocolatey Community Coffee Break

Join the Chocolatey Team as we discuss all things Community, what we do, how you can get involved and answer your Chocolatey questions.

Watch The Replays
Chocolatey and Intune Overview

Webinar Replay from
Wednesday, 30 March 2022

At Chocolatey Software we strive for simple, and teaching others. Let us teach you just how simple it could be to keep your 3rd party applications updated across your devices, all with Intune!

Watch On-Demand
Chocolatey For Business. In Azure. In One Click.

Livestream from
Thursday, 9 June 2022

Join James and Josh to show you how you can get the Chocolatey For Business recommended infrastructure and workflow, created, in Azure, in around 20 minutes.

Watch On-Demand
The Future of Chocolatey CLI

Livestream from
Thursday, 04 August 2022

Join Paul and Gary to hear more about the plans for the Chocolatey CLI in the not so distant future. We'll talk about some cool new features, long term asks from Customers and Community and how you can get involved!

Watch On-Demand
Hacktoberfest Tuesdays 2022

Livestreams from
October 2022

For Hacktoberfest, Chocolatey ran a livestream every Tuesday! Re-watch Cory, James, Gary, and Rain as they share knowledge on how to contribute to open-source projects such as Chocolatey CLI.

Watch On-Demand



Downloads of v 2.4.188:


Last Update:

09 Mar 2015

Package Maintainer(s):

Software Author(s):

  • Matt Wrock


boxstarter bootstrapper environment setup

Boxstarter Bootstrapper Module

This is not the latest version of Boxstarter Bootstrapper Module available.

  • 1
  • 2
  • 3

2.4.188 | Updated: 09 Mar 2015



Downloads of v 2.4.188:


Software Author(s):

  • Matt Wrock

Boxstarter Bootstrapper Module 2.4.188

This is not the latest version of Boxstarter Bootstrapper Module available.

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed

Validation Testing Unknown

Verification Testing Unknown

Scan Testing Successful:

No detections found in any package files

Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install Boxstarter Bootstrapper Module, run the following command from the command line or from PowerShell:


To upgrade Boxstarter Bootstrapper Module, run the following command from the command line or from PowerShell:


To uninstall Boxstarter Bootstrapper Module, run the following command from the command line or from PowerShell:


Deployment Method:


This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)

2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade boxstarter.bootstrapper -y --source="'INTERNAL REPO URL'" --version="'2.4.188'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:

choco upgrade boxstarter.bootstrapper -y --source="'INTERNAL REPO URL'" --version="'2.4.188'" 

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0

Exit $exitCode

- name: Install boxstarter.bootstrapper
    name: boxstarter.bootstrapper
    version: '2.4.188'
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.

chocolatey_package 'boxstarter.bootstrapper' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '2.4.188'

See docs at https://docs.chef.io/resource_chocolatey_package.html.

cChocoPackageInstaller boxstarter.bootstrapper
    Name     = "boxstarter.bootstrapper"
    Version  = "2.4.188"
    Source   = "INTERNAL REPO URL"

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.

package { 'boxstarter.bootstrapper':
  ensure   => '2.4.188',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.

4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Package Approved

This package was approved as a trusted package on 09 Mar 2015.


Boxstarter's Bootstrapper module provides a powershell wrapper that supports reboots and automatic logons and exposes commands that can detect pending reboots, perform logging and messaging, and several commands that can configure various windows settings.

Resolve-Path $PSScriptRoot\*.ps1 | 
    % { . $_.ProviderPath }

Import-Module (Join-Path $Boxstarter.BaseDir Boxstarter.WinConfig\BoxStarter.WinConfig.psd1) -global -DisableNameChecking

Export-ModuleMember Invoke-BoxStarter, `
                    Test-PendingReboot, `
                    Invoke-Reboot, `
                    Write-BoxstarterMessage, `
                    Start-TimedSection, `
                    Stop-TimedSection, `
                    Out-Boxstarter, `
                    Enter-BoxstarterLogable, `
function Cleanup-Boxstarter {

    if(Test-Path "$(Get-BoxstarterTempDir)\BoxstarterReEnableUAC") {
        del "$(Get-BoxstarterTempDir)\BoxstarterReEnableUAC"
    if(!$Boxstarter.IsRebooting) { 
        Write-BoxstarterMessage "Cleaning up and not rebooting" -Verbose
        $startup = "$env:appdata\Microsoft\Windows\Start Menu\Programs\Startup"
        if( Test-Path "$Startup\boxstarter-post-restart.bat") {
            Write-BoxstarterMessage "Cleaning up restart file" -Verbose
            remove-item "$Startup\boxstarter-post-restart.bat"
            remove-item "$(Get-BoxstarterTempDir)\Boxstarter.Script"
        if(Test-Path "$(Get-BoxstarterTempDir)\Boxstarter.autologon") {
            Write-BoxstarterMessage "Cleaning up autologon registry keys" -Verbose
            $winLogonKey="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
            $winlogonProps = Import-CLIXML -Path "$(Get-BoxstarterTempDir)\Boxstarter.autologon"
            @("DefaultUserName","DefaultDomainName","DefaultPassword","AutoAdminLogon") | % {
                  Remove-ItemProperty -Path $winLogonKey -Name $_ -ErrorAction SilentlyContinue
                else {
                  Set-ItemProperty -Path $winLogonKey -Name $_ -Value $winlogonProps[$_]
            Remove-Item -Path "$(Get-BoxstarterTempDir)\Boxstarter.autologon"
        if($promptToExit -or $KeepWindowOpen){
            Read-Host 'Type ENTER to exit'

    if(!(Get-IsRemote -PowershellRemoting) -and !$DisableRestart){
            Write-BoxstarterMessage "UAC Enabled. Disabling..."
            New-Item "$(Get-BoxstarterTempDir)\BoxstarterReEnableUAC" -type file | Out-Null

    if(!(Get-IsRemote -PowershellRemoting) -and $BoxstarterPassword.Length -gt 0) {
        Write-BoxstarterMessage "Securely Storing $($currentUser.Domain)\$($currentUser.Name) credentials for automatic logon"
        Set-SecureAutoLogon $currentUser.Name $BoxstarterPassword $currentUser.Domain -BackupFile "$(Get-BoxstarterTempDir)\Boxstarter.autologon"
        Write-BoxstarterMessage "Logon Set"

	Describes how to use Boxstarter to wrap powershell scripts.

	The Boxstarter.Bootstrapper module provides an execution 
	environment for running scripts that may require one or more 
	reboots throughout its exeution process. This can be any 
	powershell script and is ideally suited for scripts that involve 
	the installation of software and system configuration.

	By default, Boxstarter will not reboot a machine even when 
	Invoke-Reboot is called. In order to enable reboots, either the 
	-RebootOk switch parameter bust be set on Invoke-Boxstarter or 
	the RebootOk $Boxstarter property should be true.

	If Reoots are enabled, calling INVOKE-REBOOT will prepare the 
	Boxstarter environment for reboot and force a restart of the 
	local machine. DO NOT CALL RESTART-COMPUTER. This will not allow 
	Boxstarter to propperly prepare for reboot and will disable 
	automatic logon and not allow the Boxstarter script to continue 
	upon reboot.

	While a boxstarter script may have its own rules determining when 
	a reboot is needed, Boxstarter provides a Test-PendingReboot 
	functions which checks several machine settings to determine if a 
	reboot is needed. Credit for this script goes to Brian Wilhite's 
	original contribution at 

	Test-PendingReboot Checks several known registry keys, the windows 
	update service, component based servicing, and configuration manager. 
	If there is any indication that a reboot is pending, Test-PendingReboot 
	returns $True. Boxstarter scripts may then want to call Invoke-Reboot. 
	Many Software Installers will fail if there is a reboot pending.

	If reboots are enabled, Boxstarter will prompt the user for a password 
	when initially calling Invoke-Boxstarter. The password is given to 
	boxstarter as a SecureString. Boxstarter uses the domain and username 
	of the current user. Boxstarter will attempt to authenticate the 
	password up to three times. If the password cannot be authenticated, 
	Boxstarter will continue to run the script but the user will need to 
	manually sign on at logon. If the user succesfully authenticates, 
	Boxstarter stores the pasword in an encrypted area intended for auto 
	logon passwords.

	When the boxstarter script completes, all logon information is removed 
	from the registry and subsequent logons will prompt for credentials.

	When Boxstarter reboots, it simply reruns the script as it was 
	provided. Currently Boxstarter has no checkpointing mechanism to 
	start your script from a specific location. Of coarse, the script 
	author can include such logic. Therefore, it is best to write 
	scripts that can be run in a repeatable manner. For example, the 
	script may want to do its own checks to determine if long running 
	routines like a lengthy software install needs to be run. Is the 
	software already installed? Boxstarter scripts should anticipate 
	that any portion of the script may have been previously executed.

	Boxstarter ensures that scripts run as administrator. If you call 
	Invoke-Boxstarter from a non elevated shell, Boxstarter will 
	launch an elevated shell and run the remainder of the session 
	from tha tshell. If Boxstarter is asked to reboot via Invoke-Reboot 
	and UAC is enabled on the machine, it will disable UAC and then 
	reenable it after the machine is rebooted and the script restarts. 
	This is necessary for an unattended execution experience, otherwise 
	Boxstarter would need to have you accept the UAC prompt after reboot 
	in order to continue the Boxstarter session.

	In order to provide as little interruption as possible during a 
	Boxstarter script execution, Windows Update Service and, if installed, 
	the System Configuration Client are stopped. When Boxstarter 
	completes, these services are restarted. Boxstarter exposes 
	functionality to install Windows Updates (see below) and stopping 
	these services will not impact that functionality.

	Boxstarter provides several Logging functions. These include the 
	ability to log both to the screen and the Boxstarter Log as well as 
	the ability to log to both simultaneously. Boxstarter also enables 
	you t ocapture the standard output and error streams of standard 
	command line executables and utilities and not just the powershell 
	pipeline. See About_Boxstarter_Logging for more details.

	Boxstarter exposes several functions aimed at customizing several 
	Windows settings. All of these are located in the 
	Boxstarter.WinConfig module. These include customizing Windows 
	Explorer, the Windows Task Bar, enabling Remote desktop and much 
	more. See Get-Command -Module Boxstarter.WinConfig for the 
	functions available.



	A Hashtable for persisting Boxstarter settings.

	The Boxstarter variable is a hashtable that is globaly accesible. 
	Different Boxstarter modules may store different settings.
	Some of the bootstrapper module settings available from the 
	Boxstarter variable can also be set from the Invoke-Boxstarter 

		Indicates if the current session was automatically loged on by 
		Boxstarter after a reboot.

		The Root directory containing the Boxstarter Modules and local 
		package repository. By default this is in the users AppData 

		Indicates if Boxstarter has intiated a reboot.

		This points to the path of the Boxstarter log file. By default 
		this is $env:LocalAppData\Boxstarter\boxstarter.log. You may 
		edit this variable to change the location of the log.

		A boolean value indicating if automatic reboots are permited. 
		This is false by default but true if the -RebootOk switch is 
		used when calling Invoke-Boxstarter. You may edit this value 
		to suppress or enable reboots.

		The script that is wraped  by Boxstarter.

		A boolean value that specifies if log messages should be 
		suppressed. The default is false and can be changed at any 
		time. If true, any message logged via Write-BoxstarterMessage 
		or Star-TimedSection will not log to the console or to the 


function Get-BoxstarterTempDir {
    if($env:LocalAppData -and $env:LocalAppData.StartsWith("$env:SystemDrive\Users")){
        $dir = $env:LocalAppData
    else {
        $dir = $env:ProgramData

if(!(Test-Path "$dir\Boxstarter")){mkdir "$dir\Boxstarter" | out-null}
    return "$dir\Boxstarter"
*   This function was written by Brian Wilhite
*   Published at http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542
*   Distributed according to Technet Terms of Use
*   http://technet.microsoft.com/cc300389.aspx
Function Get-PendingReboot
	Gets the pending reboot status on a local or remote computer.

	This function will query the registry on a local or remote computer and determine if the
	system is pending a reboot, from either Microsoft Patching or a Software Installation.
	For Windows 2008+ the function will query the CBS registry key as another factor in determining
	pending reboot state.  "PendingFileRenameOperations" and "Auto Update\RebootRequired" are observed
	as being consistent across Windows Server 2003 & 2008.
	CBServicing = Component Based Servicing (Windows 2008)
	WindowsUpdate = Windows Update / Auto Update (Windows 2003 / 2008)
	PendFileRename = PendingFileRenameOperations (Windows 2003 / 2008)

.PARAMETER ComputerName
	A single Computer or an array of computer names.  The default is localhost ($env:COMPUTERNAME).

	A single path to send error data to a log file.

	PS C:\> Get-PendingReboot -ComputerName (Get-Content C:\ServerList.txt) | Format-Table -AutoSize
	Computer   CBServicing WindowsUpdate PendFileRename RebootPending
    --------   ----------- ------------- -------------- -------------
	DC01             False         False          False         False
	DC02             False         False          False         False
	FS01             False          True           True          True

	This example will capture the contents of C:\ServerList.txt and query the pending reboot
	information from the systems contained in the file and display the output in a table

	PS C:\> Get-PendingReboot
	Computer       : WKS01
	CBServicing    : False
	WindowsUpdate  : True
	PendFileRename : False
	RebootPending  : True
	This example will query the local machine for pending reboot information.
	PS C:\> $Servers = Get-Content C:\Servers.txt
	PS C:\> Get-PendingReboot -Computer $Servers | Export-Csv C:\PendingRebootReport.csv -NoTypeInformation
	This example will create a report that contains pending reboot information.

	Component-Based Servicing:
	PendingFileRename/Auto Update:

	Author: Brian Wilhite
	Email:  [email protected]
	Date:   08/29/2012
	PSVer:  2.0/3.0


		#Adjusting ErrorActionPreference to stop on all errors
		$TempErrAct = $ErrorActionPreference
		$ErrorActionPreference = "Stop"
	}#End Begin Script Block
		Foreach ($Computer in $ComputerName)
				$Computer = $Computer.ToUpper().Trim()
						#Setting pending values to false to cut down on the number of else statements
						$CBS,$WUAU,$PendFileRename,$Pending = $false, $false, $false, $false
						#Querying WMI for build version
						$WMI_OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer
						#Making registry connection to the local/remote computer
						$RegCon = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"LocalMachine",$Computer)
						#If Vista/2008 & Above query the CBS Reg Key
						If ($WMI_OS.BuildNumber -ge 6001)
								$RegSubKeysCBS = $RegCon.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\").GetSubKeyNames()
								$CBSRebootPend = $RegSubKeysCBS -contains "RebootPending"
								If ($CBSRebootPend)
										$CBS = $true
									}#End If ($CBSRebootPend)
							}#End If ($WMI_OS.BuildNumber -ge 6001)
						#Query WUAU from the registry
						$RegWUAU = $RegCon.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\")
                        if($RegWUAU -ne $null) {
						    $RegWUAURebootReq = $RegWUAU.GetSubKeyNames()
						    $WUAURebootReq = $RegWUAURebootReq -contains "RebootRequired"

						#Query PendingFileRenameOperations from the registry
						$RegSubKeySM = $RegCon.OpenSubKey("SYSTEM\CurrentControlSet\Control\Session Manager\")
						$RegValuePFRO = $RegSubKeySM.GetValue("PendingFileRenameOperations",$null)
						#Closing registry connection
						#If values from the registry are present, setting each respective variable to $true
						If ($WUAURebootReq)
								$WUAU = $true
							}#End If ($WUAURebootReq)
						If ($RegValuePFRO)
								$PendFileRename = $true
							}#End If ($RegValuePFRO)
						If ($CBS -or $WUAU -or $PendFileRename)
								$Pending = $true
							}#End If ($CBS -or $WUAU -or $PendFileRename)
						#Creating $Data Custom PSObject
						$Data = New-Object -TypeName PSObject -Property @{
								}#End $Data Custom object
						#Returning $Data object in a selected order to the user
						$Data | Select-Object -Property Computer, CBServicing, WindowsUpdate, PendFileRename, RebootPending
					}#End Try
						Write-Warning "$Computer`: $_"
						#If $ErrorLog, log the file to a user specified location/path
						If ($ErrorLog)
								Out-File -InputObject "$Computer`,$_.ToString()" -FilePath $ErrorLog -Append
							}#End If ($ErrorLog)
					}#End Catch
			}#End Foreach ($Computer in $ComputerName)
	}#End Process
		#Resetting ErrorActionPref
		$ErrorActionPreference = $TempErrAct
	}#End End
}#End Function
if(!$Global:Boxstarter) { $Global:Boxstarter = @{} }
function Invoke-BoxStarter{
Invokes the Boxstarter bootstrapper

This wraps any PowerShell script block and executes it in an environment tailored for uninterrupted installations
 - Turns off the windows update service during installation to prevent installation conflicts and minimize the need for reboots
 - Imports the Boxstarter.WinConfig module that provides functions for customizing windows
 - Provides Reboot Resiliency by ensuring the package installation is immediately restarted up on reboot if there is a reboot during the installation.
 - Ensures everything runs under administrator permissions
If the password argument is not included and RebootOk is passed, 
the user will be prompted for a password immediately after 
invoking the command and that password will be used for any 
subsequent reboot during the boxstarter run.

.Parameter ScriptToCall
The script that Boxstarter wraps. After Boxstarter shuts down 
the update services and ensures that the console is running as 
an administrator, it invokes this script. The script may call Invoke-Reboot 
at any time and Boxstarter will ensure that the machine is 
rebooted, logged in and the script is rerun.

.Parameter Password
This password will be used to automatically log the user in if a 
reboot is required and reboots are enabled.

.Parameter RebootOk
If set, a reboot will be performed if boxstarter determines that a 
reboot is pending. If no password is supplied to the Password 
parameterBoxstarter will prompt the user to enter a password which 
will be used for automatic logins in the event a restart is 

.PARAMETER KeepWindowOpen
Enabling this switch will prevent the command window from closing and 
prompt the user to pres the Enter key before the window closes. This 
is ideal when not invoking boxstarter from a console.

When set, Boxstarter will never prompt for logon. Use this if using
an account without password validation.

Invoke-Boxstarter {Import-Modler myinstaller;Invoke-MyInstall} -RebootOk

This invokes Boxstarter and invokes MyInstall. If pending 
reboots are detected, boxstarter will restart the machine. Boxstarter
will prompt the user to enter a password which will be used for 
automatic logins in the event a restart is required.

    $BoxStarter.IsRebooting = $false
    $scriptFile = "$(Get-BoxstarterTempDir)\boxstarter.script"
    if(!(Test-Admin)) {
        New-Item $scriptFile -type file -value $ScriptToCall.ToString() -force | out-null
        Write-BoxstarterMessage "User is not running with administrative rights. Attempting to elevate..."
        $unNormalized=(Get-Item "$($Boxstarter.Basedir)\Boxstarter.Bootstrapper\BoxStarter.Bootstrapper.psd1")
            $encryptedPass = convertfrom-securestring -securestring $password
            $passwordArg = "-encryptedPassword $encryptedPass"
        $command = "-ExecutionPolicy bypass -noexit -command Import-Module `"$($unNormalized.FullName)`";Invoke-BoxStarter $(if($RebootOk){'-RebootOk'}) $passwordArg"
        Start-Process powershell -verb runas -argumentlist $command
        if(!(Get-IsRemote)){ Write-BoxstarterLogo }
        $session=Start-TimedSection "Installation session." -Verbose
        if($encryptedPassword){$password = ConvertTo-SecureString -string $encryptedPassword}
            Write-BoxstarterMessage "NoPassword is false checking autologin" -verbose
            $script:BoxstarterPassword=InitAutologon $password
        if($script:BoxstarterPassword -eq $null) {
        Write-BoxstarterMessage "NoPassword is set to $($boxstarter.NoPassword) and RebootOk is set to $($Boxstarter.RebootOk) and the NoPassword parameter passed was $NoPassword" -verbose
        $Boxstarter.ScriptToCall = Resolve-Script $ScriptToCall $scriptFile
        $credPassword = $BoxstarterPassword
        if($credPassword -eq $null) {$credPassword=(New-Object System.Security.SecureString)}
        if(Get-IsRemote){ Create-BoxstarterTask (New-Object Management.Automation.PsCredential ("$($currentUser.Domain)\$($currentUser.Name)",$credPassword)) }
        return $true
    catch {
       Log-BoxStarterMessage $_
       throw $_
        Cleanup-Boxstarter -KeepWindowOpen:$KeepWindowOpen -DisableRestart:$DisableRestart
        Stop-TimedSection $session
        if($BoxStarter.IsRebooting) {

function RestartNow {
    Write-BoxstarterMessage "Restart Required. Restarting now..."
    Restart-Computer -force -ErrorAction SilentlyContinue

function Read-AuthenticatedPassword {
    while(--$attemptsLeft -ge 0 -and !$val) {
            $Password=Read-Host -AsSecureString "Autologon Password"
            $creds = New-Object System.Management.Automation.PsCredential("$($currentUser.Domain)\$($currentUser.Name)", $password)
            Start-Process "Cmd.exe" -argumentlist "/c","echo" -Credential $creds
            write-BoxstarterMessage "Successfully authenticated password."
            return $password
        catch { }
    write-BoxstarterMessage "Unable to authenticate password for $($currentUser.Domain)\$($currentUser.Name). Proceeding with autologon disabled"
    return $null

function InitAutologon([System.Security.SecureString]$password){
    $autologonKey="HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
    $winlogonProps = Get-ItemProperty -Path $autologonKey
    if($winlogonProps.AutoAdminLogon){$autoLogon=Get-ItemProperty -Path $autologonKey -Name "AutoAdminLogon"}
    if($autoLogon) {
        $autoLogon = $autoLogon.AutoAdminLogon
        if($autoLogon -gt 0) {
            try { $autoLogonCount=Get-ItemProperty -Path $autologonKey -Name "AutoLogonCount" -ErrorAction stop } catch {$global:error.RemoveAt(0)}
            if($autoLogonCount) {$autoLogon=$autoLogonCount.autoLogonCount}
    } else {$autoLogon=0}
    $Boxstarter.AutologedOn = ($autoLogon -gt 0)
    Write-BoxstarterMessage "AutoLogin status is $($Boxstarter.AutologedOn)" -verbose
    if($Boxstarter.RebootOk -and !$Password -and !$Boxstarter.AutologedOn) {
        Write-BoxstarterMessage "Please type CTRL+C or close this window to exit Boxstarter if you do not want to risk a reboot during this Boxstarter install.`r`n" -nologo -Color Yellow
        write-BoxstarterMessage @"
Boxstarter may need to reboot your system. 
Please provide your password so that Boxstarter may automatically log you on. 
Your password will be securely stored and encrypted.
"@ -nologo

    return $password

function Resolve-Script([ScriptBlock]$script, [string]$scriptFile){
    if($script) {return $script}
    if(Test-Path $scriptFile) {
        $scriptFile=(Get-Content $scriptFile)
        if($scriptFile.length -gt 0) {
            return [ScriptBlock]::Create($scriptFile)
    throw "No Script was specified to call."
function Invoke-Reboot {
Reboots the local machine ensuring Boxstarter restarts 
automatically after reboot and sets up autologon if it a 
password was provided.

Use this command inside of a boxstarter package instead 
of calling Restart-Computer

This command will often be used with the Test-PendingReboot
command. If Test-PendingReboot returns true, one may want 
to call Invoke-Reboot to restart otherwise the remainder of 
the package might fail.

One can use the $Boxstarter variable's RebootOk to enable/disable
reboots. If this is set to $False (the default) then Invoke-Reboot
will not do anything. If Boxstarter was invoked with the -RebootOk
parameter $Boxstarter.RebootOk is set to True.

    if(!$Boxstarter.RebootOk) { 
        Write-BoxstarterMessage "A Reboot was requested but Reboots are suppressed. Either call Invoke-Boxstarter with -RebootOk or set `$Boxstarter.RebootOk to `$true"
    if(!(Get-IsRemote -PowershellRemoting) -and !($Boxstarter.DisableRestart)){
        Write-BoxstarterMessage "writing restart file"
        New-Item "$(Get-BoxstarterTempDir)\Boxstarter.script" -type file -value $boxstarter.ScriptToCall -force | Out-Null
        $startup = "$env:appdata\Microsoft\Windows\Start Menu\Programs\Startup"
        $restartScript="Call PowerShell -NoProfile -ExecutionPolicy bypass -command `"Import-Module '$($Boxstarter.BaseDir)\Boxstarter.Bootstrapper\boxstarter.bootstrapper.psd1';Invoke-Boxstarter -RebootOk -NoPassword:`$$($Boxstarter.NoPassword.ToString())`""
        New-Item "$startup\boxstarter-post-restart.bat" -type file -force -value $restartScript | Out-Null
    try {
        if(Get-Module Bitlocker -ListAvailable){
            Get-BitlockerVolume | ? {$_.ProtectionStatus -eq "On"  -and $_.VolumeType -eq "operatingSystem"} | Suspend-Bitlocker -RebootCount 1 | out-null
    catch {} # There are several reports of the bitlocker module throwing errors

function Restart {
*   This function was written by Andy Arismendi
*   Published at http://poshcode.org/2982
*   Under Creative Commons License 
*   http://creativecommons.org/publicdomain/zero/1.0/legalcode
function Set-SecureAutoLogon {
param (
    [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]

    [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [System.Security.SecureString]

begin {
    [string] $WinlogonPath = "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon"
    [string] $WinlogonBannerPolicyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"

    [string] $Enable = 1
    [string] $Disable = 0
    #region C# Code to P-invoke LSA LsaStorePrivateData function.
    Add-Type @"
        using System;
        using System.Collections.Generic;
        using System.Text;
        using System.Runtime.InteropServices;

        namespace ComputerSystem
            public class LSAutil
                private struct LSA_UNICODE_STRING
                    public UInt16 Length;
                    public UInt16 MaximumLength;
                    public IntPtr Buffer;

                private struct LSA_OBJECT_ATTRIBUTES
                    public int Length;
                    public IntPtr RootDirectory;
                    public LSA_UNICODE_STRING ObjectName;
                    public uint Attributes;
                    public IntPtr SecurityDescriptor;
                    public IntPtr SecurityQualityOfService;

                private enum LSA_AccessPolicy : long
                    POLICY_VIEW_LOCAL_INFORMATION = 0x00000001L,
                    POLICY_VIEW_AUDIT_INFORMATION = 0x00000002L,
                    POLICY_GET_PRIVATE_INFORMATION = 0x00000004L,
                    POLICY_TRUST_ADMIN = 0x00000008L,
                    POLICY_CREATE_ACCOUNT = 0x00000010L,
                    POLICY_CREATE_SECRET = 0x00000020L,
                    POLICY_CREATE_PRIVILEGE = 0x00000040L,
                    POLICY_SET_DEFAULT_QUOTA_LIMITS = 0x00000080L,
                    POLICY_SET_AUDIT_REQUIREMENTS = 0x00000100L,
                    POLICY_AUDIT_LOG_ADMIN = 0x00000200L,
                    POLICY_SERVER_ADMIN = 0x00000400L,
                    POLICY_LOOKUP_NAMES = 0x00000800L,
                    POLICY_NOTIFICATION = 0x00001000L

                [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
                private static extern uint LsaRetrievePrivateData(
                            IntPtr PolicyHandle,
                            ref LSA_UNICODE_STRING KeyName,
                            out IntPtr PrivateData

                [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
                private static extern uint LsaStorePrivateData(
                        IntPtr policyHandle,
                        ref LSA_UNICODE_STRING KeyName,
                        ref LSA_UNICODE_STRING PrivateData

                [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
                private static extern uint LsaOpenPolicy(
                    ref LSA_UNICODE_STRING SystemName,
                    ref LSA_OBJECT_ATTRIBUTES ObjectAttributes,
                    uint DesiredAccess,
                    out IntPtr PolicyHandle

                [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
                private static extern uint LsaNtStatusToWinError(
                    uint status

                [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
                private static extern uint LsaClose(
                    IntPtr policyHandle

                [DllImport("advapi32.dll", SetLastError = true, PreserveSig = true)]
                private static extern uint LsaFreeMemory(
                    IntPtr buffer

                private LSA_OBJECT_ATTRIBUTES objectAttributes;
                private LSA_UNICODE_STRING localsystem;
                private LSA_UNICODE_STRING secretName;

                public LSAutil(string key)
                    if (key.Length == 0)
                        throw new Exception("Key length zero");

                    objectAttributes = new LSA_OBJECT_ATTRIBUTES();
                    objectAttributes.Length = 0;
                    objectAttributes.RootDirectory = IntPtr.Zero;
                    objectAttributes.Attributes = 0;
                    objectAttributes.SecurityDescriptor = IntPtr.Zero;
                    objectAttributes.SecurityQualityOfService = IntPtr.Zero;

                    localsystem = new LSA_UNICODE_STRING();
                    localsystem.Buffer = IntPtr.Zero;
                    localsystem.Length = 0;
                    localsystem.MaximumLength = 0;

                    secretName = new LSA_UNICODE_STRING();
                    secretName.Buffer = Marshal.StringToHGlobalUni(key);
                    secretName.Length = (UInt16)(key.Length * UnicodeEncoding.CharSize);
                    secretName.MaximumLength = (UInt16)((key.Length + 1) * UnicodeEncoding.CharSize);

                private IntPtr GetLsaPolicy(LSA_AccessPolicy access)
                    IntPtr LsaPolicyHandle;

                    uint ntsResult = LsaOpenPolicy(ref this.localsystem, ref this.objectAttributes, (uint)access, out LsaPolicyHandle);

                    uint winErrorCode = LsaNtStatusToWinError(ntsResult);
                    if (winErrorCode != 0)
                        throw new Exception("LsaOpenPolicy failed: " + winErrorCode);

                    return LsaPolicyHandle;

                private static void ReleaseLsaPolicy(IntPtr LsaPolicyHandle)
                    uint ntsResult = LsaClose(LsaPolicyHandle);
                    uint winErrorCode = LsaNtStatusToWinError(ntsResult);
                    if (winErrorCode != 0)
                        throw new Exception("LsaClose failed: " + winErrorCode);

                public void SetSecret(string value)
                    LSA_UNICODE_STRING lusSecretData = new LSA_UNICODE_STRING();

                    if (value.Length > 0)
                        //Create data and key
                        lusSecretData.Buffer = Marshal.StringToHGlobalUni(value);
                        lusSecretData.Length = (UInt16)(value.Length * UnicodeEncoding.CharSize);
                        lusSecretData.MaximumLength = (UInt16)((value.Length + 1) * UnicodeEncoding.CharSize);
                        //Delete data and key
                        lusSecretData.Buffer = IntPtr.Zero;
                        lusSecretData.Length = 0;
                        lusSecretData.MaximumLength = 0;

                    IntPtr LsaPolicyHandle = GetLsaPolicy(LSA_AccessPolicy.POLICY_CREATE_SECRET);
                    uint result = LsaStorePrivateData(LsaPolicyHandle, ref secretName, ref lusSecretData);

                    uint winErrorCode = LsaNtStatusToWinError(result);
                    if (winErrorCode != 0)
                        throw new Exception("StorePrivateData failed: " + winErrorCode);

process {

    try {
        $ErrorActionPreference = "Stop"
        $decryptedPass = [Runtime.InteropServices.Marshal]::PtrToStringAuto(

        if ($BackupFile) {
                # Initialize the hash table with a string comparer to allow case sensitive keys.
                # This allows differentiation between the winlogon and system policy logon banner strings.
            $OrigionalSettings = New-Object System.Collections.Hashtable ([system.stringcomparer]::CurrentCulture)
            $OrigionalSettings.AutoAdminLogon = (Get-ItemProperty $WinlogonPath ).AutoAdminLogon
            $OrigionalSettings.ForceAutoLogon = (Get-ItemProperty $WinlogonPath).ForceAutoLogon
            $OrigionalSettings.DefaultUserName = (Get-ItemProperty $WinlogonPath).DefaultUserName
            $OrigionalSettings.DefaultDomainName = (Get-ItemProperty $WinlogonPath).DefaultDomainName
            $OrigionalSettings.DefaultPassword = (Get-ItemProperty $WinlogonPath).DefaultPassword
            $OrigionalSettings.AutoLogonCount = (Get-ItemProperty $WinlogonPath).AutoLogonCount
                # The winlogon logon banner settings.
            $OrigionalSettings.LegalNoticeCaption = (Get-ItemProperty $WinlogonPath).LegalNoticeCaption
            $OrigionalSettings.LegalNoticeText = (Get-ItemProperty $WinlogonPath).LegalNoticeText
                # The system policy logon banner settings.
            $OrigionalSettings.legalnoticecaption = (Get-ItemProperty $WinlogonBannerPolicyPath).legalnoticecaption
            $OrigionalSettings.legalnoticetext = (Get-ItemProperty $WinlogonBannerPolicyPath).legalnoticetext
            $OrigionalSettings | Export-Clixml -Depth 10 -Path $BackupFile
            # Store the password securely.
        $lsaUtil = New-Object ComputerSystem.LSAutil -ArgumentList "DefaultPassword"

            # Store the autologon registry settings.
        Set-ItemProperty -Path $WinlogonPath -Name AutoAdminLogon -Value $Enable -Force

        Set-ItemProperty -Path $WinlogonPath -Name DefaultUserName -Value $Username -Force
        Set-ItemProperty -Path $WinlogonPath -Name DefaultDomainName -Value $Domain -Force

        if ($AutoLogonCount) {
            Set-ItemProperty -Path $WinlogonPath -Name AutoLogonCount -Value $AutoLogonCount -Force
        } else {
            try {Remove-ItemProperty -Path $WinlogonPath -Name AutoLogonCount -ErrorAction stop } catch {$global:error.RemoveAt(0)}

        if ($RemoveLegalPrompt) {
            Set-ItemProperty -Path $WinlogonPath -Name LegalNoticeCaption -Value $null -Force
            Set-ItemProperty -Path $WinlogonPath -Name LegalNoticeText -Value $null -Force
            Set-ItemProperty -Path $WinlogonBannerPolicyPath -Name legalnoticecaption -Value $null -Force
            Set-ItemProperty -Path $WinlogonBannerPolicyPath -Name legalnoticetext -Value $null -Force
    } catch {
        throw 'Failed to set auto logon. The error was: "{0}".' -f $_

        Enables auto logon using the specified username and password.

    .PARAMETER  Username
        The username of the user to automatically logon as.

    .PARAMETER  Password
        The password for the user to automatically logon as.
    .PARAMETER  Domain
        The domain of the user to automatically logon as.
    .PARAMETER  AutoLogonCount
        The number of logons that auto logon will be enabled.
    .PARAMETER  RemoveLegalPrompt
        Removes the system banner to ensure intervention-less logon.
    .PARAMETER  BackupFile
        If specified the existing settings such as the system banner text will be backed up to the specified file.

        PS C:\> Set-SecureAutoLogon `
                -Username $env:USERNAME `
                -Password (Read-Host -AsSecureString) `
                -AutoLogonCount 2 `
                -RemoveLegalPrompt `
                -BackupFile "C:\WinlogonBackup.xml"



        Revision History:
            2011-04-19 : Andy Arismendi - Created.
            2011-09-29 : Andy Arismendi - Changed to use LSA secrets to store password securely.


function Start-UpdateServices {
    write-boxstartermessage "Enabling Automatic Updates from Windows Update"
    $winUpdateKey = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\au"
    try { Remove-ItemProperty -Path $winUpdateKey -name 'NoAutoUpdate' -force -ErrorAction Stop } catch {$global:error.RemoveAt(0)}
    try {Remove-ItemProperty -Path $winUpdateKey -name 'NoAutoRebootWithLoggedOnUsers' -force -ErrorAction Stop} catch{$global:error.RemoveAt(0)}

function Start-CCMEXEC {
    $ccm = get-service -include CCMEXEC
    if($ccm -and $ccm.Status -ne "Running") {
        Write-BoxstarterMessage "Starting Configuration Manager Service"
        set-service CCMEXEC -startuptype automatic
        Enter-BoxstarterLogable { Start-Service CCMEXEC -ErrorAction SilentlyContinue }
function Stop-UpdateServices {
    write-boxstartermessage "Disabling Automatic Updates from Windows Update"
    $winUpdateKey = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\au"
    if(!(Test-Path $winUpdateKey) ) { New-Item $winUpdateKey -Type Folder -Force | Out-Null }
    try {New-ItemProperty -Path $winUpdateKey -name 'NoAutoUpdate' -value '1' -propertyType "DWord" -force -ErrorAction Stop | Out-Null}catch { $global:error.RemoveAt(0) }
    try {New-ItemProperty -Path $winUpdateKey -name 'NoAutoRebootWithLoggedOnUsers' -value '1' -propertyType "DWord" -force -ErrorAction Stop | Out-Null}catch { $global:error.RemoveAt(0) }

function Stop-CCMEXEC {
    $ccm = (get-service -include CCMEXEC)
    if($ccm) {
        set-service CCMEXEC -startuptype disabled
        do {
            if($ccm.CanStop) { 
                Write-boxstartermessage "Stopping Configuration Manager"
                Enter-BoxstarterLogable { Stop-Service CCMEXEC }
            Write-boxstartermessage "Waiting for Computer Configuration Manager to stop..."
            sleep 10
        } while (-not ($ccm.CanStop) -and ($i++ -lt 5))
function Test-PendingReboot {
Checks to see if Windows is pending a reboot

Uses a script from Brian Wilhite 
that queries the registry, Windows Update and System 
Configuration Manager to determine if a pending reboot is 

One may want to check this before installing software 
or doing anything that may fail if there is a pending 
reboot. If this command returns $true, one may want to
call Invoke-Reboot to restart the local machine.


    Write-BoxstarterMessage "Checking for Pending reboot" -Verbose
    $rebootPending = Get-PendingReboot -ErrorLog $BoxStarter.Log
    if($rebootPending.RebootPending) {
        Write-BoxstarterMessage "Detected Pending reboot" -Verbose
        Log-BoxstarterMessage "$rebootPending"
        return $true
    return IsCCMRebootPending

function IsCCMRebootPending {
    try { $clientutils = [wmiclass]"\\.\root\ccm\clientsdk:CCM_ClientUtilities" } catch{$global:error.RemoveAt(0)}
    if($clientutils) {
        try {
            if($isPending){Write-BoxstarterMessage "Configuration manager is pending reboot" -Verbose}
            return $isPending
            } catch {}
    return $false
$tools = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
. (Join-Path $tools Setup.ps1)
try { 
    $ModuleName = (Get-ChildItem $tools | ?{ $_.PSIsContainer }).BaseName
    Install-Boxstarter "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" $ModuleName $env:chocolateyPackageParameters
    Write-ChocolateySuccess $ModuleName
} catch {
    Write-ChocolateyFailure $ModuleName "$($_.Exception.Message)"
                                 Apache License
                           Version 2.0, January 2004


   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      implied, including, without limitation, any warranties or conditions
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.
function Install-Boxstarter($here, $ModuleName, $installArgs = "") {
    $boxstarterPath=Join-Path $env:AppData Boxstarter
    if(!(test-Path $boxstarterPath)){
        mkdir $boxstarterPath
    $packagePath=Join-Path $boxstarterPath BuildPackages
    if(!(test-Path $packagePath)){
        mkdir $packagePath
    foreach($ModulePath in (Get-ChildItem $here | ?{ $_.PSIsContainer })){
        $target=Join-Path $boxstarterPath $modulePath.BaseName
        if(test-Path $target){
            Remove-Item $target -Recurse -Force
    Copy-Item "$here\*" $boxstarterPath -Recurse -Force -Exclude ChocolateyInstall.ps1, Setup.*

    PersistBoxStarterPathToEnvironmentVariable "PSModulePath"
    PersistBoxStarterPathToEnvironmentVariable "Path"
    $binPath =  "$here\..\..\..\bin"
    $boxModule=Get-Module Boxstarter.Chocolatey
    if($boxModule) {
        if($boxModule.Path -like "$env:LOCALAPPDATA\Apps\*") {
        Import-Module "$boxstarterPath\$ModuleName" -DisableNameChecking -Force -ErrorAction SilentlyContinue
    $successMsg = @"
The $ModuleName Module has been copied to $boxstarterPath and added to your Module path. 
You will need to open a new console for the path to be visible.
Use 'Get-Module Boxstarter.* -ListAvailable' to list all Boxstarter Modules.
To list all available Boxstarter Commands, use:
PS:>Import-Module $ModuleName
PS:>Get-Command -Module Boxstarter.*

To find more info visit http://Boxstarter.org or use:
PS:>Import-Module $ModuleName
PS:>Get-Help Boxstarter
    Write-Host $successMsg

    if($ModuleName -eq "Boxstarter.Chocolatey" -and !$env:appdata.StartsWith($env:windir)) {
        $desktop = $([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::DesktopDirectory))
        $startMenu=$("$env:appdata\Microsoft\Windows\Start Menu\Programs\Boxstarter")
        if(!(Test-Path $startMenu)){
            mkdir $startMenu
        $targetArgs="-ExecutionPolicy bypass -NoExit -Command `"&'$boxstarterPath\BoxstarterShell.ps1'`""

		if($installArgs -inotcontains "nodesktopicon") {
			$link = Join-Path $desktop "Boxstarter Shell.lnk"
			Create-Shortcut $link $target $targetArgs $boxstarterPath
        $link = Join-Path $startMenu "Boxstarter Shell.lnk"
        Create-Shortcut $link $target $targetArgs $boxstarterPath

        Set-Content -Path "$binPath\BoxstarterShell.bat" -Force -Value "$target $TargetArgs"

function Create-Shortcut($location, $target, $targetArgs, $boxstarterPath) {
    $wshshell = New-Object -ComObject WScript.Shell
    $lnk = $wshshell.CreateShortcut($location)
    $lnk.TargetPath = $target
    $lnk.Arguments = "$targetArgs"
    $lnk.WorkingDirectory = $boxstarterPath

	$tempFile = "$env:temp\TempShortcut.lnk"
	$writer = new-object System.IO.FileStream $tempFile, ([System.IO.FileMode]::Create)
	$reader = new-object System.IO.FileStream $location, ([System.IO.FileMode]::Open)
	while ($reader.Position -lt $reader.Length)
		$byte = $reader.ReadByte()
		if ($reader.Position -eq 22) {
			$byte = 34
	Move-Item -Path $tempFile $location -Force
function PersistBoxStarterPathToEnvironmentVariable($variableName){
    $value = [Environment]::GetEnvironmentVariable($variableName, 'User')
        $values=($value -split ';' | ?{ !($_.ToLower() -match "\\boxstarter$")}) -join ';'
    elseif($variableName -eq "PSModulePath") {
        $values +="\WindowsPowerShell\Modules;$boxstarterPath"
    else {
        $values ="$boxstarterPath"
    if(!$value -or !($values -contains $boxstarterPath)){
        $values = $values.Replace(';;',';')
        [Environment]::SetEnvironmentVariable($variableName, $values, 'User')
        $varValue = Get-Content env:\$variableName
        $varValue += ";$boxstarterPath"
        $varValue = $varValue.Replace(';;',';')
        Set-Content env:\$variableName -value $varValue

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
Boxstarter Bootstrapper Module 3.0.2 34561 Monday, June 12, 2023 Approved
Boxstarter Bootstrapper Module 3.0.1 4077 Tuesday, June 6, 2023 Approved
Boxstarter Bootstrapper Module 3.0.0 91045 Thursday, July 14, 2022 Approved
Boxstarter Bootstrapper Module 3.0.0-beta-20220427-21 135 Wednesday, April 27, 2022 Exempted
Boxstarter Bootstrapper Module 2.13.0 152381 Thursday, October 15, 2020 Approved
Boxstarter Bootstrapper Module 2.12.0 389103 Tuesday, October 30, 2018 Approved
Boxstarter Bootstrapper Module 2.11.0 64797 Wednesday, May 16, 2018 Approved
Boxstarter Bootstrapper Module 2.10.3 52343 Thursday, August 31, 2017 Approved
Boxstarter Bootstrapper Module 2.9.26 5656 Monday, June 19, 2017 Approved
Boxstarter Bootstrapper Module 2.9.24 786 Sunday, June 18, 2017 Approved
Boxstarter Bootstrapper Module 2.9.14 6884 Friday, May 5, 2017 Approved
Boxstarter Bootstrapper Module 2.9.5 4775 Thursday, March 30, 2017 Approved
Boxstarter Bootstrapper Module 2.9.2 1116 Monday, March 27, 2017 Approved
Boxstarter Bootstrapper Module 2.8.29 31244 Sunday, May 22, 2016 Approved
Boxstarter Bootstrapper Module 2.8.27 420 Sunday, May 22, 2016 Approved
Boxstarter Bootstrapper Module 2.8.21 1033 Thursday, April 28, 2016 Approved
Boxstarter Bootstrapper Module 2.8.18 744 Tuesday, April 26, 2016 Approved
Boxstarter Bootstrapper Module 2.8.12 1168 Thursday, April 21, 2016 Approved
Boxstarter Bootstrapper Module 2.8.0 1152 Friday, April 15, 2016 Approved
Boxstarter Bootstrapper Module 2.7.0 2115 Sunday, April 3, 2016 Approved
Boxstarter Bootstrapper Module 2.6.41 3836 Sunday, February 28, 2016 Approved
Boxstarter Bootstrapper Module 2.6.25 6567 Friday, December 18, 2015 Approved
Boxstarter Bootstrapper Module 2.6.20 562 Thursday, December 17, 2015 Approved
Boxstarter Bootstrapper Module 2.6.16 719 Tuesday, December 15, 2015 Approved
Boxstarter Bootstrapper Module 2.6.2 686 Monday, December 14, 2015 Approved
Boxstarter Bootstrapper Module 2.6.0 520 Sunday, December 13, 2015 Approved
Boxstarter Bootstrapper Module 2.5.21 9323 Thursday, August 13, 2015 Approved
Boxstarter Bootstrapper Module 2.5.19 2086 Sunday, July 26, 2015 Approved
Boxstarter Bootstrapper Module 2.5.10 1840 Friday, July 10, 2015 Approved
Boxstarter Bootstrapper Module 2.5.3 1392 Wednesday, July 1, 2015 Approved
Boxstarter Bootstrapper Module 2.5.1 569 Wednesday, July 1, 2015 Approved
Boxstarter Bootstrapper Module 2.4.209 4588 Sunday, April 26, 2015 Approved
Boxstarter Bootstrapper Module 2.4.205 2668 Sunday, April 5, 2015 Approved
Boxstarter Bootstrapper Module 2.4.196 1580 Friday, March 20, 2015 Approved
Boxstarter Bootstrapper Module 2.4.188 1357 Monday, March 9, 2015 Approved
Boxstarter Bootstrapper Module 2.4.183 892 Wednesday, March 4, 2015 Approved
Boxstarter Bootstrapper Module 2.4.180 570 Tuesday, March 3, 2015 Approved
Boxstarter Bootstrapper Module 2.4.179 503 Tuesday, March 3, 2015 Approved
Boxstarter Bootstrapper Module 2.4.159 2848 Sunday, January 18, 2015 Approved
Boxstarter Bootstrapper Module 2.4.157 749 Thursday, January 15, 2015 Approved
Boxstarter Bootstrapper Module 2.4.152 846 Monday, January 12, 2015 Approved
Boxstarter Bootstrapper Module 2.4.149 1420 Friday, December 26, 2014 Approved
Boxstarter Bootstrapper Module 2.4.146 549 Friday, December 26, 2014 Approved
Boxstarter Bootstrapper Module 2.4.128 2013 Thursday, November 27, 2014 Approved
Boxstarter Bootstrapper Module 2.4.123 3876 Wednesday, September 24, 2014 Approved
Boxstarter Bootstrapper Module 2.4.110 848 Wednesday, September 17, 2014 Approved
Boxstarter Bootstrapper Module 2.4.93 836 Friday, September 12, 2014 Approved
Boxstarter Bootstrapper Module 2.4.88 1058 Wednesday, September 3, 2014 Approved
Boxstarter Bootstrapper Module 2.4.87 487 Wednesday, September 3, 2014 Approved
Boxstarter Bootstrapper Module 2.4.80 2797 Monday, August 4, 2014 Approved
Boxstarter Bootstrapper Module 2.4.76 553 Sunday, August 3, 2014 Approved
Boxstarter Bootstrapper Module 2.4.70 743 Thursday, July 31, 2014 Approved
Boxstarter Bootstrapper Module 2.4.67 798 Wednesday, July 30, 2014 Approved
Boxstarter Bootstrapper Module 2.4.61 696 Monday, July 28, 2014 Approved
Boxstarter Bootstrapper Module 2.4.57 486 Sunday, July 27, 2014 Approved
Boxstarter Bootstrapper Module 2.4.54 663 Wednesday, July 23, 2014 Approved
Boxstarter Bootstrapper Module 2.4.53 513 Wednesday, July 23, 2014 Approved
Boxstarter Bootstrapper Module 2.4.51 501 Wednesday, July 23, 2014 Approved
Boxstarter Bootstrapper Module 2.4.48 551 Tuesday, July 22, 2014 Approved
Boxstarter Bootstrapper Module 2.4.46 656 Saturday, July 19, 2014 Approved
Boxstarter Bootstrapper Module 2.4.41 737 Sunday, July 13, 2014 Approved
Boxstarter Bootstrapper Module 2.4.39 561 Sunday, July 13, 2014 Approved
Boxstarter Bootstrapper Module 2.4.38 578 Saturday, July 12, 2014 Approved
Boxstarter Bootstrapper Module 2.4.35 458 Saturday, July 12, 2014 Approved
Boxstarter Bootstrapper Module 2.4.32 536 Friday, July 11, 2014 Approved
Boxstarter Bootstrapper Module 2.4.29 1268 Friday, July 4, 2014 Approved
Boxstarter Bootstrapper Module 2.4.26 1132 Monday, June 23, 2014 Approved
Boxstarter Bootstrapper Module 2.4.15 3067 Sunday, April 20, 2014 Approved
Boxstarter Bootstrapper Module 2.4.12 555 Saturday, April 19, 2014 Approved
Boxstarter Bootstrapper Module 2.4.4 852 Saturday, April 5, 2014 Approved
Boxstarter Bootstrapper Module 2.4.0 513 Friday, April 4, 2014 Approved
Boxstarter Bootstrapper Module 2.3.24 1956 Saturday, February 1, 2014 Approved
Boxstarter Bootstrapper Module 2.3.15 561 Monday, January 27, 2014 Approved
Boxstarter Bootstrapper Module 2.3.13 553 Saturday, January 25, 2014 Approved
Boxstarter Bootstrapper Module 2.3.8 609 Thursday, January 23, 2014 Approved
Boxstarter Bootstrapper Module 2.3.0 590 Monday, January 20, 2014 Approved
Boxstarter Bootstrapper Module 2.2.78 746 Thursday, January 9, 2014 Approved
Boxstarter Bootstrapper Module 2.2.59 867 Sunday, December 29, 2013 Approved
Boxstarter Bootstrapper Module 2.2.23 901 Saturday, December 14, 2013 Approved
Boxstarter Bootstrapper Module 2.2.16 539 Friday, December 13, 2013 Approved
Boxstarter Bootstrapper Module 2.2.15 511 Friday, December 13, 2013 Approved
Boxstarter Bootstrapper Module 2.2.12 514 Friday, December 13, 2013 Approved
BoxStarter Bootstrapper Module 2.2.0 519 Thursday, December 12, 2013 Approved
BoxStarter Bootstrapper Module 2.1.0 672 Saturday, November 30, 2013 Approved
BoxStarter Bootstrapper Module 2.0.25 575 Wednesday, November 20, 2013 Approved
BoxStarter Bootstrapper Module 2.0.11 532 Monday, November 11, 2013 Approved
BoxStarter Bootstrapper Module 2.0.4 519 Saturday, November 9, 2013 Approved
BoxStarter Bootstrapper Module 2.0.1 500 Friday, November 8, 2013 Approved
BoxStarter Bootstrapper Module 1.1.40 651 Tuesday, October 1, 2013 Approved
BoxStarter Bootstrapper Module 1.1.35 579 Monday, August 12, 2013 Approved
BoxStarter Bootstrapper Module 1.1.30 490 Sunday, August 11, 2013 Approved
BoxStarter Bootstrapper Module 1.1.22 560 Thursday, August 8, 2013 Approved
BoxStarter Bootstrapper Module 1.1.18 550 Tuesday, August 6, 2013 Approved
BoxStarter Bootstrapper Module 1.1.12 587 Sunday, August 4, 2013 Approved
BoxStarter Bootstrapper Module 1.1.0 552 Thursday, August 1, 2013 Approved
BoxStarter Bootstrapper Module 1.0.33 619 Thursday, April 18, 2013 Approved
BoxStarter Bootstrapper Module 1.0.20 518 Monday, April 15, 2013 Approved
BoxStarter Bootstrapper Module 1.0.13 523 Monday, March 25, 2013 Approved
BoxStarter Bootstrapper Module 1.0.3 569 Wednesday, March 13, 2013 Approved

  • Fix installing modules via the c# based chocolatey
    • Pin to last PS chocolatey version until we finih new choco compatibility
    • Fix running gists from weblauncher more than once in win7 and 2008 R2
    • Suppress caught errors in Invoke-FromScheduledTask from bubbling up to final result
    • Work around nuget.exe limitations of handling files in system profile directory
    • Provide improved error logging of chocolatey errors.
    • Fixes issue where windows update reboots maching in the midst of a run.
    • Fixes failures from exceptions thrown from bitlocker module even when bitlocker is not in use.
    • Fixes Invoke-Reboot from a nested package and bubbles up the reboot signal
    • Update docs to reflect github as repo home and remove all codeplex links
    • Fix for all write-host calls being logged to Boxstarter log file even when there is no install session in progress
    • fixing issue where auto login is not disabled after boxstarter run
    • fixing wait for published version to retry for a minute if the new version is not yet marked published
    • Improve initial connectin performance by skipping remoting check if it has already been tested in enable-BoxstarterVM
    • provide messaging for some winconfig functions
    • fix the setting of azure storage account by looking for https endpoints
    • load storage module before azure to workaround bug with the storage module loading
    • copy the root path passed to New_BoxstarerPackage
    • add a DisableRestart parameter which will suppress the restart file and UAC enabling
    • Greatly improve progress messaging during windows updates runs
    • Fix hang scenarios when waiting for remote machine to reboot and landing in a pending reboot state shortly after reboot
    • Support for auto login and restart in winrm sessions
    • Fix issue with remote check causing an indefinite loop
    • Silencing some handled errors and keep them from leaking to the pipeline
    • Reduce WMI calls and Improve performance of testing if the current session is remote
    • When forcing the install of the outer boxstarter package, make sure to delete the last install from the right repo
    • Check scheduled task output for pending reboots after a remote windows update since 32 bit processes cant read the wsus registry keys
    • Fix Remote check when running as a servise
    • System user logs to programdata
    • when accessing a 64 bit machine from a 32bit process, the windowsupdate reg key is hidden so skip it
    • Bubble up errors from windows update
    • Provide the same scheduled task wrapping for winrm as we do for ps remoting
    • fix explorer restart when there is no explorer process
    • Correcting fallback Chocolatey install path to match release
    • Fixing typo param name in redirect call to set-WindowsExplorerOptions
    • Fix InvalidArgument from Set-TaskbarOptions when using lock or unlock params
    • Fix issues where explorer terminates and cannot restart after caling one of the winconfig functions
    • Import azure module from the pipeline to avoid errors when loading Boxstarter.azure
    • Suppress errors when reenabling windows update in case they had alrady been reenabled
    • Fix mis encoded dash in Install-Boxstarterackage
    • Fix issues when Chocolatey packages create a new module and call chocolatey functions from that module
    • When building packages, skip folders without a nuspec instead of throwing an error
    • Only restart the explore process of the current user when calling windows config functions
    • Fixing .net 4.5 install for local installs
    • Fixing TestRunner module loading for PSv2 clients
    • Add the following windows config features:
    • Enable/Disable showing charms when mouse is in the upper right corner
    • Enable/Disable switching apps when pointing in the upper left corner
    • Enable/Disable the option to launch powershell from win-x
    • Enable/Disable boot to desktop
    • Enable/Disable desktop background on the start screen
    • Enable/Disable showing the start screen on the active display
    • Enable/Disable showing the Apps View by default on the start screen
    • Enable/Disable searching everywhere in apps view. Not just apps.
    • Enable/Disable showing desktop apps first in results
    • Lock/Unlock task bar
    • Change taskbar icon size
    • Change location of taskbar docking
    • Add test and publish automation that can point to remote deployment targets
    • Provide build scripts for integration of tests and publishing in CI servers
    • Include configured nuget sources and local repo to all chocolatey install calls and not just the initial package
    • Fix enabling powershell remoting via WMI when password has ampersands
    • Avoid explorer.exe crashes when configuring explorer options
    • Fix Hyper-V heartbeat check in non US locales
    • Fix Azure module loading in 32 bit consoles
    • Fix shell shortcuts when user name has a space
    • Fix Azure VM Checkpoint listing when there are more than one VM in a service
    • Install .net 4.5 ONLY without affecting IIS settings when .net 4 is not present
    • Fix Azure VM integration when multiple subscriptions are present
    • Allow remote installs to be run by a non amin user
Discussion for the Boxstarter Bootstrapper Module Package

Ground Rules:

  • This discussion is only about Boxstarter Bootstrapper Module and the Boxstarter Bootstrapper Module package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or Boxstarter Bootstrapper Module, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus