© 2021 www.richardwalz.com
Richard Walz
All rights reserved.

Boxstarter Automation for the Datacenter

I recently came across a framework script called Boxstarter (www.boxstarter.org) which is an automation framework. The best way to describe it as a wrapper that goes around another executable but can handle various higher level functions.

The Benefits:

  • You only need 1 line of code to start the automation process sweet!
  • It is actively being updated by the creator (Matt Wrock) I know why he rocks! 😀
  • It handles Restarts like a Pro, and it was very simple to setup.
  • Uses Chocolatey framework for the installations and Boxstarter as wrapper to invoke and perform other functions such as restarts if needed.

I have my example script perform the following functions:

1. Enable Automatic Logon with Reboots, so if the server finishes updating and requires a restart it will restart and log back on continuing where it left off *almost*.

2. Enable and Disable various Windows Settings

3. Enable Remote Desktop

4. Disable UAC

5. Install Microsoft Updates (deemed as Critical/Important)

Example Script Code:

# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot

# Basic setup
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar
Enable-RemoteDesktop
Disable-UAC

# Update Windows and reboot if necessary
Install-WindowsUpdate -AcceptEula
if (Test-PendingReboot) { Invoke-Reboot }

How to run the code:

1.  via an elevated command prompt or cmd.exe “run as administrator” type or paste the following url into the window and press enter.  Yes I wasn’t kidding Matt Wrock made it so we only need 1 stinking line of code.  Now that is awesome.  Remember this is just an example you can make this 1 line of code do a lot more.

START http://boxstarter.org/package/url?http://cloudrigs.com/downloads/auto3.txt

boxstarter-example-shell

For more information visit:

www.boxstarter.org