Last active
November 29, 2016 09:55
-
-
Save JonCubed/24eb6f1f6a831c6d2b3786e20dfe62d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
[Switch] | |
$InstallDev = $false, | |
[Switch] | |
$InstallHome = $false, | |
[String] | |
$DataDrive, | |
[String] | |
$SourceCodeFolder, | |
[Switch] | |
$SkipWindowsUpdate, | |
[Switch] | |
$EnableWindowsAuthFeature, | |
[String] | |
$SqlServer2016IsoImage, | |
[String] | |
$SqlServer2016SaPassword, | |
[String] | |
$SqlServer2014IsoImage, | |
[String] | |
$SqlServer2014SaPassword | |
) | |
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 | |
} | |
} | |
if ($SqlServer2014IsoImage) | |
{ | |
Set-EnvironmentVariable -Key "choco:sqlserver2014:isoImage" -Value $SqlServer2014IsoImage | |
if ($SqlServer2014SaPassword) { | |
# enable mixed mode auth | |
$env:choco:sqlserver2014:SECURITYMODE="SQL" | |
$env:choco:sqlserver2014:SAPWD=$SqlServer2014SaPassword | |
} | |
} | |
$installScript = 'https://gist.githubusercontent.com/JonCubed/c8799092fae3d2862545c0b9c86e2da3/raw/bba60b056cbb578f8439d51ae8e166d98e938b56/box-sqlserver.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