Downloads:
1,053,208
Downloads of v 2.4.93:
857
Last Update:
12 Sep 2014
Package Maintainer(s):
Software Author(s):
- Matt Wrock
Tags:
boxstarter bootstrapper environment setup- Software Specific:
- Software Site
- Software License
- Package Specific:
- 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.4.93 | Updated: 12 Sep 2014
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
1,053,208
Downloads of v 2.4.93:
857
Maintainer(s):
Software Author(s):
- Matt Wrock
Boxstarter Bootstrapper Module 2.4.93
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
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.4.93 --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.4.93'" [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.93'"
$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.4.93'
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.4.93'
end
See docs at https://docs.chef.io/resource_chocolatey_package.html.
cChocoPackageInstaller boxstarter.bootstrapper
{
Name = "boxstarter.bootstrapper"
Version = "2.4.93"
Source = "INTERNAL REPO URL"
}
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
package { 'boxstarter.bootstrapper':
ensure => '2.4.93',
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 27 Nov 2014.
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 {
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.codeplex.com
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.codeplex.com
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 = @{} }
$Boxstarter.Log="$(Get-BoxstarterTempDir)\boxstarter.log"
$Boxstarter.RebootOk=$false
$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.codeplex.com
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
$credPassword = $BoxstarterPassword
if($credPassword -eq $null) {$credPassword=(New-Object System.Security.SecureString)}
$currentUser=Get-CurrentUser
if(Get-IsRemote){ Create-BoxstarterTask (New-Object Management.Automation.PsCredential ("$($currentUser.Domain)\$($currentUser.Name)",$credPassword)) }
&([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}
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 {
<#
.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.codeplex.com
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)){
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
}
if(Get-Module Bitlocker -ListAvailable){
Get-BitlockerVolume | ? {$_.ProtectionStatus -eq "On" -and $_.VolumeType -eq "operatingSystem"} | Suspend-Bitlocker -RebootCount 1 | out-null
}
$Boxstarter.IsRebooting=$true
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
$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"
$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 "Enabling Automatic Updates from Windows Update"
try { Remove-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -name 'NoAutoUpdate' -force -ErrorAction Stop } catch {$global:error.RemoveAt(0)}
try {Remove-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -name 'NoAutoRebootWithLoggedOnUsers' -force -ErrorAction Stop} catch{$global:error.RemoveAt(0)}
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"
try {New-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -name 'NoAutoUpdate' -value '1' -propertyType "DWord" -force -ErrorAction Stop | Out-Null}catch { $global:error.RemoveAt(0) }
try {New-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update' -name 'NoAutoRebootWithLoggedOnUsers' -value '1' -propertyType "DWord" -force -ErrorAction Stop | Out-Null}catch { $global:error.RemoveAt(0) }
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.codeplex.com
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) {
$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") {
$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'`""
$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 | 109316 | Monday, October 9, 2023 | Approved | |
Boxstarter Bootstrapper Module 3.0.2 | 34663 | Monday, June 12, 2023 | Approved | |
Boxstarter Bootstrapper Module 3.0.1 | 4100 | Tuesday, June 6, 2023 | Approved | |
Boxstarter Bootstrapper Module 3.0.0 | 91074 | Thursday, July 14, 2022 | Approved | |
Boxstarter Bootstrapper Module 3.0.0-beta-20220427-21 | 167 | Wednesday, April 27, 2022 | Exempted | |
Boxstarter Bootstrapper Module 2.13.0 | 152542 | Thursday, October 15, 2020 | Approved | |
Boxstarter Bootstrapper Module 2.12.0 | 389170 | Tuesday, October 30, 2018 | Approved | |
Boxstarter Bootstrapper Module 2.11.0 | 64832 | Wednesday, May 16, 2018 | Approved | |
Boxstarter Bootstrapper Module 2.10.3 | 52373 | Thursday, August 31, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.26 | 5687 | Monday, June 19, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.24 | 820 | Sunday, June 18, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.14 | 6921 | Friday, May 5, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.5 | 4799 | Thursday, March 30, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.9.2 | 1138 | Monday, March 27, 2017 | Approved | |
Boxstarter Bootstrapper Module 2.8.29 | 31274 | Sunday, May 22, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.27 | 452 | Sunday, May 22, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.21 | 1059 | Thursday, April 28, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.18 | 780 | Tuesday, April 26, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.12 | 1198 | Thursday, April 21, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.8.0 | 1175 | Friday, April 15, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.7.0 | 2141 | Sunday, April 3, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.6.41 | 3866 | Sunday, February 28, 2016 | Approved | |
Boxstarter Bootstrapper Module 2.6.25 | 6603 | Friday, December 18, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.20 | 598 | Thursday, December 17, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.16 | 740 | Tuesday, December 15, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.2 | 705 | Monday, December 14, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.6.0 | 534 | Sunday, December 13, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.21 | 9347 | Thursday, August 13, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.19 | 2114 | Sunday, July 26, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.10 | 1861 | Friday, July 10, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.3 | 1429 | Wednesday, July 1, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.5.1 | 589 | Wednesday, July 1, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.209 | 4612 | Sunday, April 26, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.205 | 2700 | Sunday, April 5, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.196 | 1601 | Friday, March 20, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.188 | 1373 | Monday, March 9, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.183 | 922 | Wednesday, March 4, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.180 | 600 | Tuesday, March 3, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.179 | 527 | Tuesday, March 3, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.159 | 2872 | Sunday, January 18, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.157 | 765 | Thursday, January 15, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.152 | 875 | Monday, January 12, 2015 | Approved | |
Boxstarter Bootstrapper Module 2.4.149 | 1450 | Friday, December 26, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.146 | 570 | Friday, December 26, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.128 | 2054 | Thursday, November 27, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.123 | 3912 | Wednesday, September 24, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.110 | 879 | Wednesday, September 17, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.93 | 857 | Friday, September 12, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.88 | 1088 | Wednesday, September 3, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.87 | 502 | Wednesday, September 3, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.80 | 2826 | Monday, August 4, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.76 | 579 | Sunday, August 3, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.70 | 771 | Thursday, July 31, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.67 | 822 | Wednesday, July 30, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.61 | 731 | Monday, July 28, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.57 | 514 | Sunday, July 27, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.54 | 698 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.53 | 538 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.51 | 520 | Wednesday, July 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.48 | 566 | Tuesday, July 22, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.46 | 679 | Saturday, July 19, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.41 | 758 | Sunday, July 13, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.39 | 585 | Sunday, July 13, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.38 | 604 | Saturday, July 12, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.35 | 498 | Saturday, July 12, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.32 | 559 | Friday, July 11, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.29 | 1302 | Friday, July 4, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.26 | 1161 | Monday, June 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.15 | 3091 | Sunday, April 20, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.12 | 589 | Saturday, April 19, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.4 | 875 | Saturday, April 5, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.4.0 | 539 | Friday, April 4, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.24 | 1970 | Saturday, February 1, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.15 | 580 | Monday, January 27, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.13 | 583 | Saturday, January 25, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.8 | 628 | Thursday, January 23, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.3.0 | 609 | Monday, January 20, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.2.78 | 781 | Thursday, January 9, 2014 | Approved | |
Boxstarter Bootstrapper Module 2.2.59 | 884 | Sunday, December 29, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.23 | 928 | Saturday, December 14, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.16 | 562 | Friday, December 13, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.15 | 538 | Friday, December 13, 2013 | Approved | |
Boxstarter Bootstrapper Module 2.2.12 | 541 | Friday, December 13, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.2.0 | 541 | Thursday, December 12, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.1.0 | 699 | Saturday, November 30, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.25 | 608 | Wednesday, November 20, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.11 | 566 | Monday, November 11, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.4 | 536 | Saturday, November 9, 2013 | Approved | |
BoxStarter Bootstrapper Module 2.0.1 | 530 | Friday, November 8, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.40 | 684 | Tuesday, October 1, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.35 | 605 | Monday, August 12, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.30 | 534 | Sunday, August 11, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.22 | 586 | Thursday, August 8, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.18 | 568 | Tuesday, August 6, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.12 | 610 | Sunday, August 4, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.1.0 | 579 | Thursday, August 1, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.33 | 655 | Thursday, April 18, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.20 | 536 | Monday, April 15, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.13 | 546 | Monday, March 25, 2013 | Approved | |
BoxStarter Bootstrapper Module 1.0.3 | 587 | Wednesday, March 13, 2013 | Approved |
- 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 0.9.8.24
- 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
-
- Boxstarter.Common (≥ 2.4.93)
- Boxstarter.WinConfig (≥ 2.4.93)
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.