Skip to content

Instantly share code, notes, and snippets.

@flcdrg
Last active March 25, 2024 01:47
Show Gist options
  • Star 35 You must be signed in to star a gist
  • Fork 14 You must be signed in to fork a gist
  • Save flcdrg/87802af4c92527eb8a30 to your computer and use it in GitHub Desktop.
Save flcdrg/87802af4c92527eb8a30 to your computer and use it in GitHub Desktop.
My BoxStarter Scripts
# 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
choco feature enable -n=useRememberedArgumentsForUpgrades
# 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 -Credential $cred -PackageName https://gist.githubusercontent.com/flcdrg/87802af4c92527eb8a30/raw/boxstarter-bare-v3.ps1
#>
# This will install NuGet module if missing
Get-PackageProvider -Name NuGet -ForceBootstrap
# PowerShellGet. Do this early as reboots are required
if (-not (Get-InstalledModule -Name PowerShellGet -ErrorAction SilentlyContinue)) {
Write-Host "Install-Module PowerShellGet"
Install-Module -Name "PowerShellGet" -AllowClobber -Force -Scope AllUsers
# Exit equivalent
Invoke-Reboot
}
# Write-Host "Set-PSRepository"
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# Windows features
choco install TelnetClient -source windowsfeatures
# choco install NetFx3 -source windowsfeatures
choco install Microsoft-Hyper-V-All -source windowsfeatures
# choco install IIS-WebServerRole IIS-NetFxExtensibility45 IIS-HttpCompressionDynamic IIS-WindowsAuthentication IIS-ASPNET45 IIS-IIS6ManagementCompatibility -source windowsfeatures
choco install Containers -source windowsfeatures
# Windows 11 uses Store for this
# choco install Microsoft-Windows-Subsystem-Linux -source windowsfeatures
# Remove unwanted Store apps
Get-AppxPackage Facebook.Facebook | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage TuneIn.TuneInRadio | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage Microsoft.MinecraftUWP | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage KeeperSecurityInc.Keeper | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage 2FE3CB00.PicsArt-PhotoStudio | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage 9E2F88E3.Twitter | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *Twitter | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *MarchofEmpires | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name king.com.* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.3DBuilder | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *Bing* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.Word | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.PowerPoint | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.Excel | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MicrosoftOfficeHub | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name DellInc.PartnerPromo | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.OneNote | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.SkypeApp | Remove-AppxPackage -ErrorAction SilentlyContinue
# Get-AppxPackage -AllUser -Name Microsoft.YourPhone | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *XBox* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MixedReality.Portal | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Microsoft3DViewer | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MSPaint | Remove-AppxPackage -ErrorAction SilentlyContinue # Paint3D
Write-Host "Temp: $($env:temp)"
choco install firefox
choco pin add -n=firefox
choco install 7zip
choco install azure-cli
choco install azure-functions-core-tools --params "'/x64'" --svc
choco install audacity
choco install becyicongrabber
choco install bind-toolsonly
choco install cascadia-code-nerd-font
# This breaks Boxstarter - https://github.com/chocolatey/boxstarter/issues/560
# choco install chocolatey-community-validation.Extension
if ((get-wmiobject Win32_ComputerSystem).manufacturer -like "*Dell*") {
choco install dellcommandupdate-uwp
}
# choco install eartrumpet
choco install echoargs
choco install ffmpeg
choco install fiddler
choco install gh
choco install git
choco install hwinfo
if ((get-wmiobject Win32_ComputerSystem).manufacturer -like "*Lenovo*") {
choco install lenovo-thinkvantage-system-update
}
#choco install logitech-options
choco install paint.net
choco pin add -n="paint.net"
choco install microsoftazurestorageexplorer
# choco install mousewithoutborders - now in PowerToys
choco install microsoftazurestorageexplorer
choco install msbuild-structured-log-viewer
# choco install NugetPackageExplorer # Use Store version
choco install office365business --params='/exclude:"Access Groove Lync OneDrive"'
choco pin add -n=office365business
choco install nvm
if (-not(Get-Command node -ErrorAction Ignore)) {
C:\ProgramData\nvm\nvm.exe install lts
C:\ProgramData\nvm\nvm.exe use lts
}
choco install obs-studio
choco install oh-my-posh
choco install PDFXchangeEditor --params '"/NoDesktopShortcuts /NoUpdater"'
# choco install python2 # Required by some NPM/Node packages (eg node-sass)
choco install powertoys
# This will conflict with earlier font packages, so make sure it happens after a reboot
choco install FiraCode # font
choco install pingplotter
choco install powershell-core
choco install rode-central
choco install rode-connect
choco install rss-builder
choco install screentogif
choco install slack
choco install synology-activebackup-for-business-agent
choco install terraform
choco install terrascan
choco install tflint
choco install tortoisegit
#choco install vagrant # Not sure why, but Boxstarter gets in a loop thinking this fails with 3010 (which should be fine)
choco install vscode
choco pin add -n=vscode
choco pin add -n="vscode.install"
choco install vswhere
choco install vt-cli
choco install windirstat
# choco install yarn
choco install zoom
choco pin add -n="zoom"
choco install zoomit
# SSMS installer includes azure data studio
choco install sql-server-management-studio --svc
# Visual Studio 2022 (Ignore virus scanning as sometimes the catalog file it downloads hasn't been scanned)
# could add --passive package parameter if you want to see the installer UI for progress
# don't install Microsoft.VisualStudio.Component.Azure.Powershell as that's the old AzureRM PowerShell bits
choco install visualstudio2022enterprise --svc --package-parameters "'--add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.VisualStudioExtension --includeRecommended --remove Microsoft.VisualStudio.Component.Azure.Powershell'"
choco pin add -n="visualstudio2022enterprise"
choco install visualstudio2022enterprise-preview --pre --svc --package-parameters "'--add Microsoft.VisualStudio.Workload.Azure --add Microsoft.VisualStudio.Workload.ManagedDesktop --add Microsoft.VisualStudio.Workload.NetWeb --add Microsoft.VisualStudio.Workload.VisualStudioExtension --includeRecommended --remove Microsoft.VisualStudio.Component.Azure.Powershell'"
choco pin add -n="visualstudio2022enterprise-preview"
# After Visual Studio
choco install dotUltimate --svc --params "'/NoCpp /NoTeamCityAddin'"
choco install nuget.commandline
# Install after other packages, so integration will work
choco install beyondcompare
choco install beyondcompare-integration
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
az extension add --name azure-devops
# Windows PowerShell modules
if (-not (Get-InstalledModule -Name Terminal-Icons -ErrorAction SilentlyContinue)) {
Write-Host "Install-Module Terminal-Icons"
Install-Module -Name "Terminal-Icons" -AllowClobber -Force -Scope AllUsers
}
# Remove pre-installed Pester Module
if (Test-Path "C:\Program Files\WindowsPowerShell\Modules\Pester\3.4.0" ) {
$module = "C:\Program Files\WindowsPowerShell\Modules\Pester"
takeown /F $module /A /R
icacls $module /reset
icacls $module /grant "*S-1-5-32-544:F" /inheritance:d /T
Remove-Item -Path $module -Recurse -Force -Confirm:$false
}
wsl --install -d Ubuntu-22.04 --no-launch
# Avoid clash with builtin function
Boxstarter.WinConfig\Install-WindowsUpdate -getUpdatesFromMS -acceptEula
Enable-UAC
# 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
choco feature enable -n=useRememberedArgumentsForUpgrades
# 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 "c:\temp" -ItemType directory -Force | Out-Null
# NuGet package provider. Do this early as reboots are required
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
Write-Host "Install-PackageProvider"
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope AllUsers -Confirm:$False
# Exit equivalent
Invoke-Reboot
}
# Install initial version of PowerShellGet
if (-not (Get-InstalledModule -Name PowerShellGet -ErrorAction SilentlyContinue)) {
Write-Host "Install-Module PowerShellGet"
Install-Module -Name "PowerShellGet" -AllowClobber -Force -Scope AllUsers
# Exit equivalent
Invoke-Reboot
}
# Upgrade to latest version (> 2.2)
if (Get-InstalledModule -Name PowerShellGet | Where-Object { $_.Version -le 2.2 } ) {
#Write-Host "Update-Module PowerShellGet"
# Unload this first to avoid
#Write-Host "Removing in-use modules"
#Remove-Module PowerShellGet -Force
#Remove-Module PackageManagement -Force
# This fails due to "module 'PackageManagement' is currently in use" error. Don't think there's a way around this.
#PowerShellGet\Update-Module -Name PowerShellGet -Force
# Exit equivalent
#Invoke-Reboot
}
# Write-Host "Set-PSRepository"
# Set-PSRepository -Name PSGallery -InstallationPolicy Trusted -Force
# Windows features
choco install TelnetClient -source windowsfeatures
choco install NetFx3 -source windowsfeatures
choco install Microsoft-Hyper-V-All -source windowsfeatures
choco install IIS-WebServerRole IIS-NetFxExtensibility45 IIS-HttpCompressionDynamic IIS-WindowsAuthentication IIS-ASPNET45 IIS-IIS6ManagementCompatibility -source windowsfeatures
choco install Containers -source windowsfeatures
choco install Microsoft-Windows-Subsystem-Linux -source windowsfeatures
# Remove unwanted Store apps
Get-AppxPackage Facebook.Facebook | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage TuneIn.TuneInRadio | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage Microsoft.MinecraftUWP | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage KeeperSecurityInc.Keeper | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage 2FE3CB00.PicsArt-PhotoStudio | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage 9E2F88E3.Twitter | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *Twitter | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *MarchofEmpires | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name king.com.* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.3DBuilder | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *Bing* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.Word | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.PowerPoint | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.Excel | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MicrosoftOfficeHub | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name DellInc.PartnerPromo | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Office.OneNote | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MicrosoftSolitaireCollection | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.SkypeApp | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.YourPhone | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name *XBox* | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MixedReality.Portal | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.Microsoft3DViewer | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxPackage -AllUser -Name Microsoft.MSPaint | Remove-AppxPackage -ErrorAction SilentlyContinue # Paint3D
Write-Host "Temp: $($env:temp)"
choco install firefox-dev --pre --cacheLocation="c:\temp"
# cinst firefox --cacheLocation="c:\temp"
# choco pin add -n=firefox
cinst 7zip --cacheLocation="c:\temp"
cinst azure-cli --cacheLocation="c:\temp"
cinst azure-functions-core-tools-3 --cacheLocation="c:\temp" --params "'/x64'"
cinst becyicongrabber --cacheLocation="c:\temp"
choco install cascadia-code-nerd-font --cacheLocation="c:\temp"
if ((get-wmiobject Win32_ComputerSystem).manufacturer -like "*Dell*") {
cinst dellcommandupdate-uwp --cacheLocation="c:\temp"
}
cinst eartrumpet --cacheLocation="c:\temp"
cinst git --cacheLocation="c:\temp"
cinst hwinfo --cacheLocation="c:\temp"
if ((get-wmiobject Win32_ComputerSystem).manufacturer -like "*Lenovo*") {
cinst lenovo-thinkvantage-system-update --cacheLocation="c:\temp"
}
cinst paint.net --cacheLocation="c:\temp"
# cinst mousewithoutborders --cacheLocation="c:\temp"
cinst msbuild-structured-log-viewer --cacheLocation="c:\temp"
cinst nodejs --cacheLocation="c:\temp"
cinst nuget.commandline --cacheLocation="c:\temp"
# cinst NugetPackageExplorer --cacheLocation="c:\temp" # Use Store version
choco install office365business --cacheLocation="c:\temp" --params='/exclude:"Access Groove Lync OneDrive"'
cinst nvm --cacheLocation="c:\temp"
cinst PDFXchangeEditor --cacheLocation="c:\temp" --params '"/NoDesktopShortcuts /NoUpdater"'
cinst python2 --cacheLocation="c:\temp" # Required by some NPM/Node packages (eg node-sass)
# This will conflict with earlier font packages, so make sure it happens after a reboot
cinst FiraCode --cacheLocation="c:\temp" # font
cinst pingplotter --cacheLocation="c:\temp"
cinst powershell-core --cacheLocation="c:\temp"
cinst rocolatey --cacheLocation="c:\temp"
cinst rss-builder --cacheLocation="c:\temp"
cinst slack --cacheLocation="c:\temp"
cinst tortoisegit --cacheLocation="c:\temp"
# cinst tortoisesvn --cacheLocation="c:\temp"
#cinst vagrant --cacheLocation="c:\temp" # Not sure why, but Boxstarter gets in a loop thinking this fails with 3010 (which should be fine)
cinst vscode --cacheLocation="c:\temp"
#choco pin add -n=visualstudiocode
cinst vswhere --cacheLocation="c:\temp"
cinst windirstat --cacheLocation="c:\temp"
cinst yarn --cacheLocation="c:\temp"
cinst zoom --cacheLocation="c:\temp"
cinst zoomit --cacheLocation="c:\temp"
cinst sql-server-management-studio --cacheLocation="c:\temp"
# SSMS installer includes azure data studio
# cinst azure-data-studio --cacheLocation="c:\temp"
# Visual Studio 2019
choco install visualstudio2019enterprise --cacheLocation="c:\temp"
choco install visualstudio2019-workload-visualstudioextension --cacheLocation="c:\temp"
choco install visualstudio2019-workload-manageddesktop --cacheLocation="c:\temp"
choco install visualstudio2019-workload-netweb --cacheLocation="c:\temp" # ASP.NET and web development
choco install visualstudio2019-workload-netcoretools --cacheLocation="c:\temp" # .NET Core cross-platform development
choco install visualstudio2019-workload-node --cacheLocation="c:\temp" #Node.js development
choco install visualstudio2019-workload-azure --cacheLocation="c:\temp"
cinst dotUltimate --cacheLocation="c:\temp" --params "'/NoCpp /NoTeamCityAddin /NoRider'"
# choco install docker-desktop --cacheLocation="c:\temp"
# $docker = "C:\Program Files\Docker\Docker\Resources\bin\docker.exe"
# Install-Module posh-git -AllowPrerelease -Force
# 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, so integration will work
cinst beyondcompare --cacheLocation="c:\temp"
cinst beyondcompare-integration --cacheLocation="c:\temp"
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
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
#vEnable-RemoteDesktop
# Windows features
cinst TelnetClient -source windowsfeatures
# Reboot?
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
New-Item -Path "c:\temp" -ItemType directory -Force | Out-Null
# SQL Server - do this early to avoid issues with newer versions of VC++ 2015 redist
choco install sql-server-2019 --cacheLocation="c:\temp"
choco install sql-server-2019-cumulative-update --cacheLocation="c:\temp"
choco install sql-server-management-studio --cacheLocation="c:\temp"
# tools
choco install azure-functions-core-tools-3 --cacheLocation="c:\temp"
choco install becyicongrabber --cacheLocation="c:\temp"
choco install cake-bakery.portable --cacheLocation="c:\temp"
choco install cascadiacodepl --cacheLocation="c:\temp"
choco install 7zip --cacheLocation="c:\temp"
choco install firacode --cacheLocation="c:\temp"
choco install firefox --cacheLocation="c:\temp"
choco install git --cacheLocation="c:\temp"
choco install nodejs --cacheLocation="c:\temp"
choco install nuget.commandline --cacheLocation="c:\temp"
choco install tortoisegit --cacheLocation="c:\temp"
choco install vscode --cacheLocation="c:\temp"
choco install yarn --cacheLocation="c:\temp"
choco install 7zip --cacheLocation="c:\temp"
# Visual Studio 2019
choco install visualstudio2019enterprise --cacheLocation="c:\temp"
choco install visualstudio2019-workload-manageddesktop --cacheLocation="c:\temp"
choco install visualstudio2019-workload-netcoretools --cacheLocation="c:\temp"
choco install visualstudio2019-workload-netweb --cacheLocation="c:\temp"
choco install visualstudio2019-workload-node --cacheLocation="c:\temp"
choco install visualstudio2019-workload-visualstudioextension --cacheLocation="c:\temp"
cinst beyondcompare --cacheLocation="c:\temp"
cinst beyondcompare-integration --cacheLocation="c:\temp"
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableExpandToOpenFolder
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
choco install dotUltimate --params "'/NoCpp /NoTeamCityAddin /NoRider'"
# 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")
New-Item -Path "c:\temp" -ItemType directory -Force | Out-Null
cinst audacity --cacheLocation="c:\temp"
cinst itunes --cacheLocation="c:\temp"
cinst dropbox --cacheLocation="c:\temp"
choco install rss-builder --cacheLocation="c:\temp"
choco pin add -n=GoogleChrome
choco pin add -n=azure-data-studio
choco pin add -n=docker-desktop
choco pin add -n=visualstudio2019enterprise
choco pin add -n=firefox
choco pin add -n=Office365Business
choco pin add -n=vscode
choco pin add -n="vscode.install"
choco pin add -n="dotnetcore-sdk"
choco pin add -n="microsoft-edge"
choco pin add -n="paint.net"
# This will install NuGet module if missing
Get-PackageProvider -Name NuGet -ForceBootstrap
# PowerShellGet. Do this early as reboots are required
if (-not (Get-InstalledModule -Name PowerShellGet -ErrorAction SilentlyContinue)) {
Write-Host "Install-Module PowerShellGet"
Install-Module -Name "PowerShellGet" -AllowClobber -Force -Scope AllUsers
# Exit equivalent
Invoke-Reboot
}
# Write-Host "Set-PSRepository"
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# 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
PowerShellGet\Install-Module posh-git -Scope CurrentUser -AllowPrerelease -Force
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
Get-Command Install-WindowsUpdate
get-module
help Boxstarter.WinConfig\Install-WindowsUpdate
# Avoid clash with builtin function
Boxstarter.WinConfig\Install-WindowsUpdate -getUpdatesFromMS -acceptEula
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment