Skip to content

Instantly share code, notes, and snippets.

@JonCubed
Last active May 22, 2017 13:15
Show Gist options
  • Save JonCubed/9dd488c3073a244b78befe45ccca991b to your computer and use it in GitHub Desktop.
Save JonCubed/9dd488c3073a244b78befe45ccca991b to your computer and use it in GitHub Desktop.
param
(
[Switch]
$InstallDev = $false,
[Switch]
$InstallHome = $false,
[String]
$DataDrive,
[String]
$SourceCodeFolder,
[Switch]
$SkipWindowsUpdate,
[Switch]
$EnableWindowsAuthFeature,
[String]
$SqlServer2016IsoImage,
[String]
$SqlServer2016SaPassword
)
function Set-EnvironmentVariable
{
param
(
[String]
[Parameter(Mandatory=$true)]
$Key,
[String]
[Parameter(Mandatory=$true)]
$Value
)
[Environment]::SetEnvironmentVariable($Key, $Value, "Machine") # for reboots
[Environment]::SetEnvironmentVariable($Key, $Value, "Process") # for right now
}
if ($InstallDev)
{
Set-EnvironmentVariable -Key "BoxStarter:InstallDev" -Value "1"
}
if ($InstallHome)
{
Set-EnvironmentVariable -Key "BoxStarter:InstallHome" -Value "1"
}
if ($DataDrive)
{
Set-EnvironmentVariable -Key "BoxStarter:DataDrive" -Value $DataDrive
}
if ($SourceCodeFolder)
{
Set-EnvironmentVariable -Key "BoxStarter:SourceCodeFolder" -Value $SourceCodeFolder
}
if ($SkipWindowsUpdate)
{
Set-EnvironmentVariable -Key "BoxStarter:SkipWindowsUpdate" -Value "1"
}
if ($EnableWindowsAuthFeature)
{
Set-EnvironmentVariable -Key "BoxStarter:EnableWindowsAuthFeature" -Value "1"
}
if ($SqlServer2016IsoImage)
{
Set-EnvironmentVariable -Key "choco:sqlserver2016:isoImage" -Value $SqlServer2016IsoImage
if ($SqlServer2016SaPassword) {
# enable mixed mode auth
$env:choco:sqlserver2016:SECURITYMODE="SQL"
$env:choco:sqlserver2016:SAPWD=$SqlServer2016SaPassword
}
}
$installScript = 'https://gist.githubusercontent.com/JonCubed/93c8e02148569202b455725f2ecc6785/raw/fad4cdffd8121a02d3add0d3de00d48e5387d58e/box.ps1'
$webLauncherUrl = "http://boxstarter.org/package/nr/url?$installScript"
$edgeVersion = Get-AppxPackage -Name Microsoft.MicrosoftEdge
if ($edgeVersion)
{
start microsoft-edge:$webLauncherUrl
}
else
{
$IE=new-object -com internetexplorer.application
$IE.navigate2($webLauncherUrl)
$IE.visible=$true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment