Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My BoxStarter Scripts
# SQL Server - do this early to avoid issues with newer versions of VC++ 2015 redist
choco install sql-server-2017
choco install sql-server-2017-cumulative-update --version 14.0.3029.16
choco install sql-server-management-studio
# tools
choco install git
choco install nodejs
choco install tortoisegit
choco install visualstudiocode
choco pin add -n=visualstudiocode
choco install yarn
choco install 7zip
# .NET
choco install dotnet4.5
choco install dotnet4.6
choco install dotnet4.6.1
choco install dotnet4.6.2
choco install dotnet4.7
choco install dotnet4.7.1
choco install dotnetcore-sdk
choco install netfx-4.5.1-devpack
choco install netfx-4.5.2-devpack
choco install netfx-4.6.1-devpack
choco install netfx-4.7-devpack
choco install netfx-4.7.1-devpack
# Visual Studio 2017
choco install visualstudio2017professional
choco install visualstudio2017-workload-manageddesktop
choco install visualstudio2017-workload-netcoretools
choco install visualstudio2017-workload-netweb
choco install visualstudio2017-workload-node
# 1. Install Chocolatey
<#
Set-ExecutionPolicy RemoteSigned -Force
# Create empty profile (so profile-integration scripts have something to append to)
if (-not (Test-Path $PROFILE)) {
$directory = [IO.Path]::GetDirectoryName($PROFILE)
if (-not (Test-Path $directory)) {
New-Item -ItemType Directory $directory | Out-Null
}
"# Profile" > $PROFILE
}
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n=allowGlobalConfirmation
# Copy chocolatey.license.xml to C:\ProgramData\chocolatey\license
choco install chocolatey.extension
choco install boxstarter
#>
# 2. Run with this:
<#
$cred=Get-Credential domain\username
Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/flcdrg/87802af4c92527eb8a30/raw/boxstarter-bare.ps1 -Credential $cred
#>
# https://github.com/mwrock/boxstarter/issues/241#issuecomment-336028348
New-Item -Path "$env:userprofile\AppData\Local\ChocoCache" -ItemType directory -Force | Out-Null
$common = "--cacheLocation `"$env:userprofile\AppData\Local\ChocoCache`""
Update-ExecutionPolicy RemoteSigned
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableExpandToOpenFolder
# No SMB1 - https://blogs.technet.microsoft.com/filecab/2016/09/16/stop-using-smb1/
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
Enable-RemoteDesktop
# Windows features
choco install NetFx3 TelnetClient Microsoft-Hyper-V-All IIS-WebServerRole IIS-NetFxExtensibility45 IIS-HttpCompressionDynamic IIS-WindowsAuthentication IIS-ASPNET45 IIS-IIS6ManagementCompatibility Containers -source windowsfeatures
cinst keepass $common
cinst firefox $common
choco pin add -n=firefox
cinst GoogleChrome $common
choco pin add -n=GoogleChrome
cinst 7zip $common
cinst audacity $common
cinst audacity-lame $common # also gets audacity too
cinst becyicongrabber $common
cinst camtasia $common
if ((get-wmiobject Win32_ComputerSystem).manufacturer -like "*Dell*") {
cinst dellcommandupdate $common
}
cinst dropbox $common
choco pin add -n=dropbox
cinst FiraCode $common # font
cinst git $common
cinst itunes $common
cinst javaruntime $common
cinst keepass-plugin-favicon $common
if ((get-wmiobject Win32_ComputerSystem).manufacturer -like "*Lenovo*") {
cinst lenovo-thinkvantage-system-update $common
}
cinst paint.net --ignore-checksums $common # ignore required as of 20170321
cinst microsoft-teams.install $common
choco pin add -n="microsoft-teams.install"
cinst msbuild-structured-log-viewer $common
cinst nodejs $common
cinst notepadplusplus $common
cinst nuget.commandline $common
cinst NugetPackageExplorer $common
cinst OctopusTools $common
choco install office365business $common
cinst procmon $common
cinst PDFXchangeEditor $common
cinst python2 $common
cinst screentogif $common
cinst skype $common
cinst snagit $common
cinst tailblazer --ignore-checksums $common
cinst tortoisegit $common
cinst tortoisesvn $common
cinst ubiquiti-unifi-controller $common
cinst visualstudiocode $common
choco pin add -n=visualstudiocode
cinst vswhere $common
cinst wifiinfoview $common
cinst windirstat $common
cinst x-lite $common
cinst yarn $common
cinst zoomit $common
cinst sql-server-management-studio $common
# Visual Studio 2017
choco install visualstudio2017enterprise $common
choco install visualstudio2017-workload-visualstudioextension $common
choco install visualstudio2017-workload-manageddesktop $common
choco install visualstudio2017-workload-netweb $common
choco install visualstudio2017-workload-netcoretools $common
choco install visualstudio2017-workload-node $common
cinst resharper-ultimate-all $common
cinst ozcode-vs2017 $common
cinst typescript-vs2017 $common
choco install docker-for-windows $common
$docker = "C:\Program Files\Docker\Docker\Resources\bin\docker.exe"
# Assume by default Linux containers
#if (-not(& $docker info | Select-String -SimpleMatch linux)) {
# & 'c:\Program Files\docker\docker\dockercli.exe' -SwitchDaemon | Out-Null # Handle 'The operation has timed out
# Start-Sleep -Seconds 5
#}
# Docker for Linux is not working here. Not sure why.
# & docker version
# & $docker pull microsoft/dotnet
# & $docker pull microsoft/mssql-server-linux
# & $docker pull microsoft/aspnetcore
# Switch to Windows
#& 'c:\Program Files\docker\docker\dockercli.exe' -SwitchDaemon
#& $docker pull microsoft/nanoserver
# & $docker pull microsoft/mssql-server-windows-developer
# & $docker pull microsoft/windowsservercore
# NuGet package provider
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module posh-docker
Install-Module posh-git
# Enable Developer Mode
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1
# Assume if we had to create that then we need to reboot.
Invoke-Reboot
}
# Enable Linux subsystem (requires developer mode enabled)
cinst Microsoft-Windows-Subsystem-Linux -source windowsFeatures
C:\windows\system32\inetsrv\appcmd.exe unlock config -section:windowsAuthentication
C:\windows\system32\inetsrv\appcmd.exe unlock config -section:anonymousAuthentication
# Note: There are ususally VS Solution-specific config file in .vs\config\applicationhost.config too
& "C:\Program Files\IIS Express\appcmd.exe" unlock config -section:windowsAuthentication
& "C:\Program Files\IIS Express\appcmd.exe" unlock config -section:anonymousAuthentication
#PowerShell help
Update-Help -ErrorAction SilentlyContinue
# rssbuilder
# Install after other packages, so integration will work
cinst beyondcompare $common
cinst beyondcompare-integration $common
# Remove unwanted Store apps
Get-AppxPackage Facebook.Facebook | Remove-AppxPackage
Get-AppxPackage TuneIn.TuneInRadio | Remove-AppxPackage
Get-AppxPackage Microsoft.MinecraftUWP | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage
Get-AppxPackage KeeperSecurityInc.Keeper | Remove-AppxPackage
Get-AppxPackage 2FE3CB00.PicsArt-PhotoStudio | Remove-AppxPackage
Get-AppxPackage 9E2F88E3.Twitter | Remove-AppxPackage
Get-AppxPackage Microsoft.BingNews | Remove-AppxPackage
Install-WindowsUpdate -AcceptEula -GetUpdatesFromMS
Enable-UAC
# Run with START http://boxstarter.org/package/url?https://gist.githubusercontent.com/flcdrg/87802af4c92527eb8a30/raw/demo01.ps1
Update-ExecutionPolicy RemoteSigned
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableExpandToOpenFolder
Enable-RemoteDesktop
# Windows features
cinst TelnetClient -source windowsfeatures
# Reboot?
choco install powershell #KB2999226
# Chocolatey packages
#cinst beyondcompare
cinst zoomit
# Second demo script
<#
$cred=Get-Credential flcdrg
Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/flcdrg/87802af4c92527eb8a30/raw/demo02.ps1 -Credential $cred
#>
New-Item -Path "$env:userprofile\AppData\Local\ChocoCache" -ItemType directory -Force | Out-Null
$common = "--cacheLocation=`"$env:userprofile\AppData\Local\ChocoCache`""
choco install notepadplusplus $common
# https://github.com/mwrock/boxstarter/issues/241#issuecomment-336028348
New-Item -Path "$env:userprofile\AppData\Local\ChocoCache" -ItemType directory -Force | Out-Null
$common = "--cacheLocation=`"$env:userprofile\AppData\Local\ChocoCache`""
choco install bginfo-startup -pre -packageParameters '/RunImmediately' $common
choco install NetFx3 -source windowsfeatures
choco install dotnetcore-runtime $common
choco install dotnetcore-sdk --version=2.1.302 $common
choco install dotnetcore-sdk --version=2.1.403 $common
choco install git $common
choco install yarn $common
# .NET Framework
choco install dotnet4.5 $common
choco install dotnet4.6 $common
choco install dotnet4.6.1 $common
choco install dotnet4.6.2 $common
choco install dotnet4.7 $common
choco install dotnet4.7.1 $common
choco install dotnet4.7.2 $common
choco install dotnetcore-sdk $common
choco install netfx-4.5.1-devpack $common
choco install netfx-4.5.2-devpack $common
choco install netfx-4.6.1-devpack $common
choco install netfx-4.7-devpack $common
choco install netfx-4.7.1-devpack $common
choco install netfx-4.7.2-devpack $common
# Visual Studio
choco install visualstudio2017buildtools --params "'--add Microsoft.Net.Component.4.5.TargetingPack'" $common
choco pin add -n=visualstudio2017buildtools $common
choco install visualstudio2017-workload-manageddesktop $common
choco pin add -n="visualstudio2017-workload-manageddesktop" $common
choco install visualstudio2017-workload-netcoretools $common
choco pin add -n="visualstudio2017-workload-netcoretools" $common
choco install visualstudio2017-workload-netweb $common
choco pin add -n="visualstudio2017-workload-netweb" $common
choco install visualstudio2017-workload-node $common
choco pin add -n="visualstudio2017-workload-node" $common
# Stop MSBuild processes from hanging around
[Environment]::SetEnvironmentVariable("MSBUILDDISABLENODEREUSE", "1", "Machine")
choco pin add -n=GoogleChrome
# Is x86 sticky?
cinst notepadplusplus --x86
cinst microsoft-teams
# 1. Install Chocolatey
<#
Set-ExecutionPolicy RemoteSigned
# Create empty profile (so profile-integration scripts have something to append to)
if (-not (Test-Path $PROFILE)) {
$directory = [IO.Path]::GetDirectoryName($PROFILE)
if (-not (Test-Path $directory)) {
New-Item -ItemType Directory $directory | Out-Null
}
"# Profile" > $PROFILE
}
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature enable -n=allowGlobalConfirmation
choco install boxstarter
#>
# 2. Run with this:
<#
$cred=Get-Credential flcdrg
Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/flcdrg/87802af4c92527eb8a30/raw/simple-dev.ps1 -Credential $cred
#>
# https://github.com/mwrock/boxstarter/issues/241#issuecomment-336028348
New-Item -Path "$env:userprofile\AppData\Local\ChocoCache" -ItemType directory -Force | Out-Null
$common = "--cacheLocation=`"$env:userprofile\AppData\Local\ChocoCache`""
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableExpandToOpenFolder
# No SMB1 - https://blogs.technet.microsoft.com/filecab/2016/09/16/stop-using-smb1/
Disable-WindowsOptionalFeature -Online -FeatureName smb1protocol
Enable-RemoteDesktop -DoNotRequireUserLevelAuthentication # Disable RULA For RDP to AzureAD connected PCs
# Windows features
Enable-WindowsOptionalFeature -Online -FeatureName NetFx3, TelnetClient,Microsoft-Hyper-V-All
choco install IIS-WebServerRole IIS-NetFxExtensibility45 IIS-HttpCompressionDynamic IIS-WindowsAuthentication IIS-ASPNET45 IIS-IIS6ManagementCompatibility -source windowsfeatures $common
choco install Containers -source windowsfeatures $common
# SQL Server - do this early to avoid issues with newer versions of VC++ 2015 redist
# Because dependencies call Install-WindowsUpdate, this will force a full Windows Update check.
choco install sql-server-2017 $common
choco install sql-server-2017-cumulative-update --version 14.0.3029.16 $common
choco install sql-server-management-studio $common
choco install powershell $common
cinst GoogleChrome $common
choco pin add -n=GoogleChrome $common
cinst firefox $common
choco pin add -n=firefox $common
cinst FiraCode $common # font
cinst git $common
cinst keepass $common
cinst keepass-plugin-favicon $common
cinst microsoft-teams.install $common
choco pin add -n="microsoft-teams.install" $common
cinst nodejs $common
cinst notepadplusplus $common
cinst NugetPackageExplorer $common
cinst PDFXchangeEditor $common
cinst python2 $common
cinst skype $common
cinst tailblazer $common --ignore-checksums
cinst tortoisegit $common
cinst tortoisesvn $common
cinst visualstudiocode $common
choco pin add -n=visualstudiocode $common
cinst windirstat $common
cinst zoomit $common
cinst yarn $common
cinst 7zip $common
# Visual Studio 2017
choco install dotnet4.5 $common
choco install dotnet4.6 $common
choco install dotnet4.6.1 $common
choco install dotnet4.6.2 $common
choco install dotnet4.7 $common
choco install dotnet4.7.1 $common
choco install dotnet4.7.2 $common
choco install dotnetcore-sdk $common
choco install netfx-4.5.1-devpack $common
choco install netfx-4.5.2-devpack $common
choco install netfx-4.6.1-devpack $common
choco install netfx-4.7-devpack $common
choco install netfx-4.7.1-devpack $common
choco install netfx-4.7.2-devpack $common
choco install visualstudio2017professional $common
choco pin add -n="visualstudio2017professional" $common
choco install visualstudio2017-workload-manageddesktop $common
choco pin add -n="visualstudio2017-workload-manageddesktop" $common
choco install visualstudio2017-workload-netcoretools $common
choco pin add -n="visualstudio2017-workload-netcoretools" $common
choco install visualstudio2017-workload-netweb $common
choco pin add -n="visualstudio2017-workload-netweb" $common
choco install visualstudio2017-workload-node $common
choco pin add -n="visualstudio2017-workload-node" $common
Write-BoxstarterMessage "NuGet package provider"
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module posh-git
Write-BoxstarterMessage "Enable Developer Mode"
$RegistryKeyPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock"
if (-not(Test-Path -Path $RegistryKeyPath)) {
New-Item -Path $RegistryKeyPath -ItemType Directory -Force
# Add registry value to enable Developer Mode
New-ItemProperty -Path $RegistryKeyPath -Name AllowDevelopmentWithoutDevLicense -PropertyType DWORD -Value 1
# Assume if we had to create that then we need to reboot.
$Boxstarter.RebootOk = $true
Invoke-Reboot
}
# Enable Linux subsystem (requires developer mode enabled)
choco install Microsoft-Windows-Subsystem-Linux -source windowsFeatures $common
C:\windows\system32\inetsrv\appcmd.exe unlock config -section:windowsAuthentication
C:\windows\system32\inetsrv\appcmd.exe unlock config -section:anonymousAuthentication
# Note: There are ususally VS Solution-specific config file in .vs\config\applicationhost.config too
& "C:\Program Files\IIS Express\appcmd.exe" unlock config -section:windowsAuthentication
& "C:\Program Files\IIS Express\appcmd.exe" unlock config -section:anonymousAuthentication
#PowerShell help
Update-Help -ErrorAction SilentlyContinue
# Install after other packages
cinst beyondcompare $common
cinst beyondcompare-integration $common
Install-WindowsUpdate -AcceptEula -GetUpdatesFromMS
Enable-UAC
# Troublesome packages
# cinst paint.net $common
# [Environment]::SetEnvironmentVariable("TeamCityServerUrl", "http://teamcity:8111", "machine")
# [Environment]::SetEnvironmentVariable("BOXSTARTER_NO_VS", "1", "machine")
# [Environment]::SetEnvironmentVariable("TeamCityServiceAccount", "ServiceAccount", "machine")
# [Environment]::SetEnvironmentVariable("TeamCityServiceAccountPassword", "Password", "machine")
$installVisualStudio = (-not (Test-Path env:BOXSTARTER_NO_VS))
Update-ExecutionPolicy RemoteSigned
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableExpandToOpenFolder
Enable-UAC
cinst powershell
cinst 7zip
cinst bginfo
cinst bginfo-startup -pre -packageParameters '/RunImmediately'
cinst notepadplusplus
cinst server-jre
cinst windirstat
if ($installVisualStudio) {
cinst windbg # Required for symbol server support
}
# cinst msbuild.communitytasks
cinst tailblazer
# Install external Chocolatey (https://groups.google.com/forum/#!searchin/boxstarter/install$20chocolatey/boxstarter/9Y0EEDJ8I3I/-0gsGurxMAAJ)
if (-not (Test-Path c:\ProgramData\chocolatey\bin\choco.exe))
{
iwr https://chocolatey.org/install.ps1 | iex
}
# Make bginfo run on startup/login
if (-not (Test-Path "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\bginfo.lnk"))
{
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\bginfo.lnk")
$Shortcut.TargetPath = "C:\ProgramData\chocolatey\bin\Bginfo.exe"
$Shortcut.Arguments = "/nolicprompt /timer:0"
$Shortcut.Save()
}
# Run bginfo right now
C:\ProgramData\chocolatey\bin\Bginfo.exe /nolicprompt /timer:0
if ($installVisualStudio) {
# This can take a really long time, so allow 2 hour timeout
# (ClickOnceV1 provides signtool.exe)
choco install VisualStudio2015Professional -packageParameters "--Features SilverLight_Developer_KitV1,ClickOnceV1" --execution-timeout=7200
cinst wixtoolset
cinst nodejs
cinst git
# .NET Core
choco install dotnetcore-sdk # Latest
if (-not (Get-Command -CommandType Application -ErrorAction SilentlyContinue -Name bower))
{
& "C:\Program Files\nodejs\npm.cmd" install -g bower
}
choco install visualstudio2017buildtools
choco install visualstudio2017-workload-webbuildtools
choco install visualstudio2017-workload-manageddesktop
choco install visualstudio2017-workload-netcoretools
}
if (Test-Path env:TeamCityServerUrl)
{
if (-not (Get-NetFirewallRule -DisplayName "Allow TeamCity" -ErrorAction Ignore))
{
New-NetFirewallRule -DisplayName "Allow TeamCity" -Direction Inbound -Protocol TCP -LocalPort 9090 -Action Allow
}
$teamCityServerUrl = $env:TeamCityServerUrl
$serviceAccount = $env:TeamCityServiceAccount
$serviceAccountPassword = $env:TeamCityServiceAccountPassword
cinst TeamCityAgent --ignore-checksums --params '"serverurl=$teamCityServerUrl serviceAccount=$serviceAccount serviceAccountPassword=$serviceAccountPassword"'
}
cinst teamcity-vstest-customlogger
# Install-WindowsUpdate -AcceptEula -GetUpdatesFromMS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.