Downloads:
1,040,215
Downloads of v 2.6.41:
3,857
Last Update:
28 Feb 2016
Package Maintainer(s):
Software Author(s):
- Matt Wrock
Tags:
boxstarter bootstrapper environment setup- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Boxstarter Bootstrapper Module
This is not the latest version of Boxstarter Bootstrapper Module available.
- 1
- 2
- 3
2.6.41 | Updated: 28 Feb 2016
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Possible Package Source
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
1,040,215
Downloads of v 2.6.41:
3,857
Maintainer(s):
Software Author(s):
- Matt Wrock
Boxstarter Bootstrapper Module 2.6.41
This is not the latest version of Boxstarter Bootstrapper Module available.
- 1
- 2
- 3
All Checks are Passing
3 Passing Tests
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
Option 1: Cached Package (Unreliable, Requires Internet - Same As Community)-
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
-
Open Source
-
Download the package:
Download - Follow manual internalization instructions
-
-
Package Internalizer (C4B)
-
Run: (additional options)
choco download boxstarter.bootstrapper --internalize --version=2.6.41 --source=https://community.chocolatey.org/api/v2/
-
For package and dependencies run:
choco push --source="'INTERNAL REPO URL'"
- Automate package internalization
-
Run: (additional options)
3. Copy Your Script
choco upgrade boxstarter.bootstrapper -y --source="'INTERNAL REPO URL'" --version="'2.6.41'" [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.6.41'"
$exitCode = $LASTEXITCODE
Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
Exit 0
}
Exit $exitCode
- name: Install boxstarter.bootstrapper
win_chocolatey:
name: boxstarter.bootstrapper
version: '2.6.41'
source: INTERNAL REPO URL
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.6.41'
end
See docs at https://docs.chef.io/resource_chocolatey_package.html.
cChocoPackageInstaller boxstarter.bootstrapper
{
Name = "boxstarter.bootstrapper"
Version = "2.6.41"
Source = "INTERNAL REPO URL"
}
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
package { 'boxstarter.bootstrapper':
ensure => '2.6.41',
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.
This package was approved as a trusted package on 28 Feb 2016.
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, `
Get-BoxstarterTempDir
function Cleanup-Boxstarter {
param(
[switch]$KeepWindowOpen,
[switch]$DisableRestart)
if(Get-IsRemote){
Remove-BoxstarterTask
}
Start-UpdateServices
if(Test-Path "$(Get-BoxstarterTempDir)\BoxstarterReEnableUAC") {
del "$(Get-BoxstarterTempDir)\BoxstarterReEnableUAC"
Enable-UAC
}
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"
$promptToExit=$true
}
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") | % {
if(!$winlogonProps.ContainsKey($_)){
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'
}
return
}
if(!(Get-IsRemote -PowershellRemoting) -and !$DisableRestart){
if(Get-UAC){
Write-BoxstarterMessage "UAC Enabled. Disabling..."
Disable-UAC
New-Item "$(Get-BoxstarterTempDir)\BoxstarterReEnableUAC" -type file | Out-Null
}
}
if(!(Get-IsRemote -PowershellRemoting) -and $BoxstarterPassword.Length -gt 0) {
$currentUser=Get-CurrentUser
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"
}
}
TOPIC
About_Boxstarter_Bootstrapper
SYNOPSIS
Describes how to use Boxstarter to wrap powershell scripts.
DESCRIPTION
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.
ENABLING REBOOTS
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.
DETERMINING IF A REBOOT IS NEEDED
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
http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542.
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.
AUTOMATIC LOGON
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.
WRITING BOXSTARTER SCRIPTS FOR REBOOTS
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.
RUNNING AS ADMIN
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.
UPDATE SERVICES
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.
LOGGING
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.
WINDOWS CONFIGURATION UTILITIES
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.
SEE ALSO
http://boxstarter.org
about_boxstarter_logging
Invoke-Boxstarter
Invoke-Reboot
about_boxstarter_variable_in_bootstrapper
TOPIC
About_Boxstarter_Variable_In_Bootstrapper
SYNOPSIS
A Hashtable for persisting Boxstarter settings.
DESCRIPTION
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
Command.
BOXSTARTER VARIABLE SETTINGS
AutoLogon
Indicates if the current session was automatically loged on by
Boxstarter after a reboot.
BaseDir
The Root directory containing the Boxstarter Modules and local
package repository. By default this is in the users AppData
directory.
IsRebooting
Indicates if Boxstarter has intiated a reboot.
Log
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.
RebootOk
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.
ScriptToCall
The script that is wraped by Boxstarter.
SuppressLogging
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
file.
SEE ALSO
http://boxstarter.org
Invoke-Boxstarter
Write-BoxstarterMessage
Start-TimedSection
about_boxstarter_logging
Invoke-Reboot
about_boxstarter_bootstrapper
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
{
<#
.SYNOPSIS
Gets the pending reboot status on a local or remote computer.
.DESCRIPTION
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).
.PARAMETER ErrorLog
A single path to send error data to a log file.
.EXAMPLE
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
.EXAMPLE
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.
.EXAMPLE
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.
.LINK
Component-Based Servicing:
http://technet.microsoft.com/en-us/library/cc756291(v=WS.10).aspx
PendingFileRename/Auto Update:
http://support.microsoft.com/kb/2723674
http://technet.microsoft.com/en-us/library/cc960241.aspx
http://blogs.msdn.com/b/hansr/archive/2006/02/17/patchreboot.aspx
.NOTES
Author: Brian Wilhite
Email: [email protected]
Date: 08/29/2012
PSVer: 2.0/3.0
#>
[CmdletBinding()]
param(
[Parameter(Position=0,ValueFromPipeline=$true)]
[Alias("CN","Computer")]
[String[]]$ComputerName="$env:COMPUTERNAME",
[String]$ErrorLog
)
Begin
{
#Adjusting ErrorActionPreference to stop on all errors
$TempErrAct = $ErrorActionPreference
$ErrorActionPreference = "Stop"
}#End Begin Script Block
Process
{
Foreach ($Computer in $ComputerName)
{
$Computer = $Computer.ToUpper().Trim()
Try
{
#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
$RegCon.Close()
#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 @{
Computer=$Computer
CBServicing=$CBS
WindowsUpdate=$WUAU
PendFileRename=$PendFileRename
RebootPending=$Pending
}#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
Catch
{
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
End
{
#Resetting ErrorActionPref
$ErrorActionPreference = $TempErrAct
}#End End
}#End Function
if(!$Global:Boxstarter) { $Global:Boxstarter = @{} }
if(!$Boxstarter.ContainsKey('Log')) {
$Boxstarter.Log="$(Get-BoxstarterTempDir)\boxstarter.log"
}
if(!$Boxstarter.ContainsKey('RebootOk')) { $Boxstarter.RebootOk=$false }
if(!$Boxstarter.ContainsKey('IsRebooting')) { $Boxstarter.IsRebooting=$false }
function Invoke-BoxStarter{
<#
.SYNOPSIS
Invokes the Boxstarter bootstrapper
.DESCRIPTION
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
required.
.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.
.PARAMETER NoPassword
When set, Boxstarter will never prompt for logon. Use this if using
an account without password validation.
.EXAMPLE
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.
.LINK
http://boxstarter.org
about_boxstarter_variable_in_bootstrapper
about_boxstarter_bootstrapper
Invoke-Reboot
#>
[CmdletBinding()]
param(
[Parameter(Position=0,Mandatory=0)]
[ScriptBlock]$ScriptToCall,
[Parameter(Position=1,Mandatory=0)]
[System.Security.SecureString]$password,
[Parameter(Position=2,Mandatory=0)]
[switch]$RebootOk,
[Parameter(Position=3,Mandatory=0)]
[string]$encryptedPassword=$null,
[Parameter(Position=4,Mandatory=0)]
[switch]$KeepWindowOpen,
[Parameter(Position=5,Mandatory=0)]
[switch]$NoPassword,
[Parameter(Position=6,Mandatory=0)]
[switch]$DisableRestart
)
$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")
if($password){
$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
return
}
$session=$null
try{
if(!(Get-IsRemote)){ Write-BoxstarterLogo }
$session=Start-TimedSection "Installation session." -Verbose
if($RebootOk){$Boxstarter.RebootOk=$RebootOk}
if($DisableRestart){$Boxstarter.DisableRestart=$DisableRestart}
if($encryptedPassword){$password = ConvertTo-SecureString -string $encryptedPassword}
if(!$NoPassword){
Write-BoxstarterMessage "NoPassword is false checking autologin" -verbose
$boxstarter.NoPassword=$False
$script:BoxstarterPassword=InitAutologon $password
}
if($script:BoxstarterPassword -eq $null) {
$boxstarter.NoPassword=$True
}
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
Stop-UpdateServices
&([ScriptBlock]::Create($Boxstarter.ScriptToCall))
return $true
}
catch {
Log-BoxStarterMessage $_
throw $_
}
finally{
Cleanup-Boxstarter -KeepWindowOpen:$KeepWindowOpen -DisableRestart:$DisableRestart
Stop-TimedSection $session
if($BoxStarter.IsRebooting) {
RestartNow
}
}
}
function RestartNow {
Write-BoxstarterMessage "Restart Required. Restarting now..."
Restart-Computer -force -ErrorAction SilentlyContinue
}
function Read-AuthenticatedPassword {
$attemptsLeft=3
while(--$attemptsLeft -ge 0 -and !$val) {
try{
$Password=Read-Host -AsSecureString "Autologon Password"
$currentUser=Get-CurrentUser
$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
$Password=Read-AuthenticatedPassword
}
return $password
}
function Resolve-Script([ScriptBlock]$script, [string]$scriptFile){
if($script) {return $script.ToString()}
if(Test-Path $scriptFile) {
$scriptFile=(Get-Content $scriptFile)
if($scriptFile.length -gt 0) {
return $scriptFile
}
}
throw "No Script was specified to call."
}
function Invoke-Reboot {
<#
.SYNOPSIS
Reboots the local machine ensuring Boxstarter restarts
automatically after reboot and sets up autologon if it a
password was provided.
.DESCRIPTION
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.
.NOTES
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.
.LINK
http://boxstarter.org
Test-PendingReeboot
Invoke-Boxstarter
about_boxstarter_bootstrapper
about_boxstarter_variable_in_bootstrapper
#>
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"
return
}
if(!(Get-IsRemote -PowershellRemoting) -and !($Boxstarter.DisableRestart)){
if(!$Boxstarter.ScriptToCall) {
Write-BoxstarterMessage "Invoke-Reboot must be called from a Boxstarter package."
return
}
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
$Boxstarter.IsRebooting=$true
if($Boxstarter.SourcePID -ne $Null) {
Write-BoxstarterMessage "Writing restart marker with pid $($Boxstarter.SourcePID) from $PID" -verbose
New-Item "$(Get-BoxstarterTempDir)\Boxstarter.$($Boxstarter.SourcePID).restart" -type file -value "" -force | Out-Null
}
Restart
}
function Restart {
exit
}
<#
***********************************************************************************
* 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 {
[cmdletbinding()]
param (
[Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]
$Username,
[Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [System.Security.SecureString]
$Password,
[string]
$Domain,
[Int]
$AutoLogonCount,
[switch]
$RemoveLegalPrompt,
[string]
$BackupFile
)
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
{
[StructLayout(LayoutKind.Sequential)]
private struct LSA_UNICODE_STRING
{
public UInt16 Length;
public UInt16 MaximumLength;
public IntPtr Buffer;
}
[StructLayout(LayoutKind.Sequential)]
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);
}
else
{
//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);
ReleaseLsaPolicy(LsaPolicyHandle);
uint winErrorCode = LsaNtStatusToWinError(result);
if (winErrorCode != 0)
{
throw new Exception("StorePrivateData failed: " + winErrorCode);
}
}
}
}
"@
#endregion
}
process {
try {
$ErrorActionPreference = "Stop"
$decryptedPass = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)
)
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
if((Get-ItemProperty $WinlogonPath).DefaultPassword) {
$OrigionalSettings.DefaultPassword = (Get-ItemProperty $WinlogonPath).DefaultPassword
Remove-ItemProperty -Path $WinlogonPath -Name DefaultPassword -Force
}
$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"
$lsaUtil.SetSecret($decryptedPass)
# 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 $_
}
}
}
<#
.SYNOPSIS
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.
.EXAMPLE
PS C:\> Set-SecureAutoLogon `
-Username $env:USERNAME `
-Password (Read-Host -AsSecureString) `
-AutoLogonCount 2 `
-RemoveLegalPrompt `
-BackupFile "C:\WinlogonBackup.xml"
.INPUTS
None.
.OUTPUTS
None.
.NOTES
Revision History:
2011-04-19 : Andy Arismendi - Created.
2011-09-29 : Andy Arismendi - Changed to use LSA secrets to store password securely.
.LINK
http://support.microsoft.com/kb/324737
.LINK
http://msdn.microsoft.com/en-us/library/aa378750
#>
function Start-UpdateServices {
write-boxstartermessage "Restore Automatic Updates from Windows Update"
$winUpdateKey = "HKLM:SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\au"
Remove-BoxstarterError {
Remove-ItemProperty -Path $winUpdateKey -name 'NoAutoUpdate' -force
Remove-ItemProperty -Path $winUpdateKey -name 'NoAutoRebootWithLoggedOnUsers' -force
# Restore original value
Rename-ItemProperty -Path $winUpdateKey -NewName 'NoAutoUpdate' -Name 'NoAutoUpdate_BAK'
}
Start-CCMEXEC
}
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 }
Remove-BoxstarterError {
# Backup original value
Rename-ItemProperty -Path $winUpdateKey -Name 'NoAutoUpdate' -NewName 'NoAutoUpdate_BAK'
New-ItemProperty -Path $winUpdateKey -name 'NoAutoUpdate' -value '1' -propertyType "DWord" -force | Out-Null
New-ItemProperty -Path $winUpdateKey -name 'NoAutoRebootWithLoggedOnUsers' -value '1' -propertyType "DWord" -force | Out-Null
}
Stop-CCMEXEC
}
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 }
return
}
Write-boxstartermessage "Waiting for Computer Configuration Manager to stop..."
sleep 10
} while (-not ($ccm.CanStop) -and ($i++ -lt 5))
}
}
function Test-PendingReboot {
<#
.SYNOPSIS
Checks to see if Windows is pending a reboot
.DESCRIPTION
Uses a script from Brian Wilhite
http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542
that queries the registry, Windows Update and System
Configuration Manager to determine if a pending reboot is
required.
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.
.LINK
http://boxstarter.org
http://gallery.technet.microsoft.com/scriptcenter/Get-PendingReboot-Query-bdb79542
Invoke-Reboot
about_boxstarter_bootstrapper
#>
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 {
$determination=$clientutils.DetermineIfRebootPending()
$isPending=$determination.RebootPending
if($isPending){Write-BoxstarterMessage "Configuration manager is pending reboot" -Verbose}
return $isPending
} catch {}
}
return $false
}
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
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,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
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\*") {
$clickonce=$true
}
}
if(!$clickonce){
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
}
$target="powershell.exe"
$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
$lnk.IconLocation="$boxstarterPath\BoxLogo.ico"
$lnk.Save()
$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
}
$writer.WriteByte($byte)
}
$reader.Close()
$writer.Close()
Move-Item -Path $tempFile $location -Force
}
function PersistBoxStarterPathToEnvironmentVariable($variableName){
$value = [Environment]::GetEnvironmentVariable($variableName, 'User')
if($value){
$values=($value -split ';' | ?{ !($_.ToLower() -match "\\boxstarter$")}) -join ';'
$values+=";$boxstarterPath"
}
elseif($variableName -eq "PSModulePath") {
$values=[environment]::getfolderpath("mydocuments")
$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.3 | 97307 | Monday, October 9, 2023 | Approved | |
Boxstarter Bootstrapper Module 3.0.2 | 34600 | Monday, June 12, 2023 | Approved | |
Boxstarter Bootstrapper Module 3.0.1 | 4093 | Tuesday, June 6, 2023 | Approved | |
Boxstarter Bootstrapper Module 3.0.0 | 91064 | Thursday, July 14, 2022 | Approved | |
Boxstarter Bootstrapper Module 3.0.0-beta-20220427-21 | 158 | Wednesday, April 27, 2022 | Exempted | |
Boxstarter Bootstrapper Module 2.13.0 | 152455 | Thursday, October 15, 2020 | Approved | |
Boxstarter Bootstrapper Module 2.12.0 | 389134 | Tuesday, October 30, 2018 | Approved | |
Boxstarter Bootstrapper Module 2.11.0 | 64822 | Wednesday, May 16, 2018 | Approved | |
Boxstarter Bootstrapper Module 2.10.3 | 52365 | Thursday, August 31, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.26 | 5678 | Monday, June 19, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.24 | 812 | Sunday, June 18, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.14 | 6909 | Friday, May 5, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.5 | 4792 | Thursday, March 30, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.2 | 1131 | Monday, March 27, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.8.29 | 31263 | Sunday, May 22, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.27 | 443 | Sunday, May 22, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.21 | 1048 | Thursday, April 28, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.18 | 767 | Tuesday, April 26, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.12 | 1186 | Thursday, April 21, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.0 | 1174 | Friday, April 15, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.7.0 | 2136 | Sunday, April 3, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.6.41 | 3857 | Sunday, February 28, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.6.25 | 6588 | Friday, December 18, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.20 | 585 | Thursday, December 17, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.16 | 736 | Tuesday, December 15, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.2 | 701 | Monday, December 14, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.0 | 531 | Sunday, December 13, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.21 | 9340 | Thursday, August 13, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.19 | 2106 | Sunday, July 26, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.10 | 1853 | Friday, July 10, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.3 | 1419 | Wednesday, July 1, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.1 | 584 | Wednesday, July 1, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.209 | 4605 | Sunday, April 26, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.205 | 2685 | Sunday, April 5, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.196 | 1593 | Friday, March 20, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.188 | 1369 | Monday, March 9, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.183 | 913 | Wednesday, March 4, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.180 | 593 | Tuesday, March 3, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.179 | 521 | Tuesday, March 3, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.159 | 2868 | Sunday, January 18, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.157 | 760 | Thursday, January 15, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.152 | 864 | Monday, January 12, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.149 | 1441 | Friday, December 26, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.146 | 565 | Friday, December 26, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.128 | 2043 | Thursday, November 27, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.123 | 3900 | Wednesday, September 24, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.110 | 875 | Wednesday, September 17, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.93 | 854 | Friday, September 12, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.88 | 1077 | Wednesday, September 3, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.87 | 499 | Wednesday, September 3, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.80 | 2817 | Monday, August 4, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.76 | 574 | Sunday, August 3, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.70 | 765 | Thursday, July 31, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.67 | 818 | Wednesday, July 30, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.61 | 720 | Monday, July 28, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.57 | 508 | Sunday, July 27, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.54 | 683 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.53 | 529 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.51 | 514 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.48 | 563 | Tuesday, July 22, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.46 | 668 | Saturday, July 19, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.41 | 753 | Sunday, July 13, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.39 | 576 | Sunday, July 13, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.38 | 596 | Saturday, July 12, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.35 | 483 | Saturday, July 12, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.32 | 553 | Friday, July 11, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.29 | 1290 | Friday, July 4, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.26 | 1153 | Monday, June 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.15 | 3084 | Sunday, April 20, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.12 | 582 | Saturday, April 19, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.4 | 867 | Saturday, April 5, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.0 | 528 | Friday, April 4, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.24 | 1965 | Saturday, February 1, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.15 | 570 | Monday, January 27, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.13 | 567 | Saturday, January 25, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.8 | 621 | Thursday, January 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.0 | 606 | Monday, January 20, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.2.78 | 769 | Thursday, January 9, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.2.59 | 875 | Sunday, December 29, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.23 | 920 | Saturday, December 14, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.16 | 554 | Friday, December 13, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.15 | 532 | Friday, December 13, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.12 | 528 | Friday, December 13, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.2.0 | 533 | Thursday, December 12, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.1.0 | 689 | Saturday, November 30, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.25 | 601 | Wednesday, November 20, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.11 | 553 | Monday, November 11, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.4 | 533 | Saturday, November 9, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.1 | 520 | Friday, November 8, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.40 | 673 | Tuesday, October 1, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.35 | 597 | Monday, August 12, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.30 | 520 | Sunday, August 11, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.22 | 574 | Thursday, August 8, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.18 | 564 | Tuesday, August 6, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.12 | 604 | Sunday, August 4, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.0 | 569 | Thursday, August 1, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.33 | 645 | Thursday, April 18, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.20 | 531 | Monday, April 15, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.13 | 536 | Monday, March 25, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.3 | 578 | Wednesday, March 13, 2013 | Approved |
- Fix CredSSP rollback from setting bogus delegate computers
- Fis Boxstarter.Azure dependency pins
- Add ability to set the User Level Authentication Required setting when enabling RDP
- Fix parsing of choco args delimiting key/values with an = sign
- Use default credentials on web client downloading http scripts
- Use internal function to download http gist scripts.
- No longer vendors a legacy version of Chocolatey. Leverages the current beta Chocolatey library API for all Chocolatey interaction.
-
- Boxstarter.Common (≥ 2.6.41)
- Boxstarter.WinConfig (≥ 2.6.41)
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.