-
-
Save wickdninja/e22c414f7f45839e31332d1712c92cb7 to your computer and use it in GitHub Desktop.
Boxstarter Commands for a new Windows box.
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
# Author: Nate Ross @wickdninja (https://wickd.ninja) | |
# HEAVILY BASED ON https://gist.github.com/jessfraz/7c319b046daa101a4aaef937a20ff41f | |
# Thanks to Jess Frazelle <[email protected]> | |
# 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 | |
choco install boxstarter | |
#> | |
# 2. Run with this: | |
<# | |
Install-BoxstarterPackage -PackageName URL_TO_GIST.boxstarter.ps1 | |
#> | |
$Boxstarter.RebootOk = $false | |
$Boxstarter.NoPassword = $false # Is this a machine with no logon password? | |
$Boxstarter.AutoLogin = $true | |
#---- TEMPORARY --- | |
Disable-UAC | |
# https://github.com/mwrock/boxstarter/issues/241#issuecomment-336028348 | |
New-Item -Path "c:\temp" -ItemType directory -Force | Out-Null | |
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 | |
# 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 | |
# 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 | |
# 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 NetFx3 TelnetClient Microsoft-Hyper-V-All IIS-WebServerRole IIS-NetFxExtensibility45 IIS-HttpCompressionDynamic IIS-WindowsAuthentication IIS-ASPNET45 IIS-IIS6ManagementCompatibility Containers -source windowsfeatures --cacheLocation="c:\temp" | |
# UNINSTALL STUFF | |
#--- Uninstall unecessary applications that come with Windows out of the box --- | |
# THIS WAS BLOWING UP... I HAD TO RUN DIRECTLY VIA POWERSHELL. Throws errors when trying to remove "required" apps but does remove bloatware | |
# DISABLE All BLOATWARE EXCEPT STORE | |
# Get-AppxPackage -AllUsers | where-object {$_.name –notlike "*store*"} | Remove-AppxPackage | |
# TURN OFF STUFF | |
#--- Windows Settings --- | |
Disable-BingSearch | |
Disable-GameBarTips | |
#--- Windows Settings --- | |
# Some from: @NickCraver's gist https://gist.github.com/NickCraver/7ebf9efbfd0c3eab72e9 | |
# Privacy: Let apps use my advertising ID: Disable | |
If (-Not (Test-Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo")) { | |
New-Item -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo | Out-Null | |
} | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0 | |
# WiFi Sense: HotSpot Sharing: Disable | |
If (-Not (Test-Path "HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting")) { | |
New-Item -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowWiFiHotSpotReporting -Name value -Type DWord -Value 0 | |
# WiFi Sense: Shared HotSpot Auto-Connect: Disable | |
Set-ItemProperty -Path HKLM:\Software\Microsoft\PolicyManager\default\WiFi\AllowAutoConnectToWiFiSenseHotspots -Name value -Type DWord -Value 0 | |
# Activity Tracking: Disable | |
@('EnableActivityFeed', 'PublishUserActivities', 'UploadUserActivities') | % { Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\System -Name $_ -Type DWord -Value 0 } | |
# Start Menu: Disable Bing Search Results | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 0 | |
# To Restore (Enabled): | |
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Search -Name BingSearchEnabled -Type DWord -Value 1 | |
# Disable Telemetry (requires a reboot to take effect) | |
# Note this may break Insider builds for your organization | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection -Name AllowTelemetry -Type DWord -Value 0 | |
Get-Service DiagTrack, Dmwappushservice | Stop-Service | Set-Service -StartupType Disabled | |
# Change Explorer home screen back to "This PC" | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 1 | |
# Change it back to "Quick Access" (Windows 10 default) | |
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name LaunchTo -Type DWord -Value 2 | |
# Better File Explorer | |
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneExpandToCurrentFolder -Value 1 | |
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name NavPaneShowAllFolders -Value 1 | |
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced -Name MMTaskbarMode -Value 2 | |
# These make "Quick Access" behave much closer to the old "Favorites" | |
# Disable Quick Access: Recent Files | |
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 0 | |
# Disable Quick Access: Frequent Folders | |
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 0 | |
# To Restore: | |
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowRecent -Type DWord -Value 1 | |
# Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer -Name ShowFrequent -Type DWord -Value 1 | |
# Disable the Lock Screen (the one before password prompt - to prevent dropping the first character) | |
If (-Not (Test-Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization)) { | |
New-Item -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows -Name Personalization | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1 | |
# To Restore: | |
# Set-ItemProperty -Path HKLM:\SOFTWARE\Policies\Microsoft\Windows\Personalization -Name NoLockScreen -Type DWord -Value 1 | |
# Lock screen (not sleep) on lid close | |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power' -Name AwayModeEnabled -Type DWord -Value 1 | |
# To Restore: | |
# Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Power' -Name AwayModeEnabled -Type DWord -Value 0 | |
# Use the Windows 7-8.1 Style Volume Mixer | |
# If (-Not (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MTCUVC")) { | |
# New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name MTCUVC | Out-Null | |
# } | |
# Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MTCUVC" -Name EnableMtcUvc -Type DWord -Value 0 | |
# To Restore (Windows 10 Style Volume Control): | |
# Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\MTCUVC" -Name EnableMtcUvc -Type DWord -Value 1 | |
# Disable Xbox Gamebar | |
Set-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\GameDVR" -Name AppCaptureEnabled -Type DWord -Value 0 | |
Set-ItemProperty -Path "HKCU:\System\GameConfigStore" -Name GameDVR_Enabled -Type DWord -Value 0 | |
# Turn off People in Taskbar | |
If (-Not (Test-Path "HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People")) { | |
New-Item -Path HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People | Out-Null | |
} | |
Set-ItemProperty -Path "HKCU:SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\People" -Name PeopleBand -Type DWord -Value 0 | |
# INSTALL STUFF | |
#--- Fonts --- | |
choco install inconsolata -y | |
#--- Windows Subsystems/Features --- | |
choco install Microsoft-Hyper-V-All -source windowsFeatures | |
choco install Microsoft-Windows-Subsystem-Linux -source windowsfeatures | |
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.appx -UseBasicParsing | |
Add-AppxPackage -Path ~/Ubuntu.appx | |
#--- Apps --- | |
choco install googlechrome --cacheLocation="c:\temp" | |
choco install docker-desktop --cacheLocation="c:\temp" | |
choco install sharex --cacheLocation="c:\temp" | |
choco install microsoft-windows-terminal --cacheLocation="c:\temp" | |
choco install 1password --cacheLocation="c:\temp" | |
choco install slack --cacheLocation="c:\temp" | |
choco install openvpn --cacheLocation="c:\temp" | |
choco install google-drive-file-stream --cacheLocation="c:\temp" | |
choco install zoom --cacheLocation="c:\temp" | |
choco install postman --cacheLocation="c:\temp" | |
choco install vscode --cacheLocation="c:\temp" | |
choco pin add -n=vscode | |
choco install visualstudio2019community --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 visualstudio2015-update --cacheLocation="c:\temp" | |
#--- Tools --- | |
choco install git -params '"/GitAndUnixToolsOnPath /WindowsTerminal"' -y --cacheLocation="c:\temp" | |
choco install poshgit -y --cacheLocation="c:\temp" | |
choco install sysinternals -y --cacheLocation="c:\temp" | |
choco install vim --cacheLocation="c:\temp" | |
choco install putty --cacheLocation="c:\temp" | |
choco install fiddler --cacheLocation="c:\temp" | |
choco install resharper-ultimate-all -params '"/PerMachine /NoCpp /NoTeamCityAddin"' -y --cacheLocation="c:\temp" | |
choco install jdk11 --cacheLocation="c:\temp" | |
cinst nodejs --cacheLocation="c:\temp" | |
cinst nuget.commandline --cacheLocation="c:\temp" | |
cinst NugetPackageExplorer --cacheLocation="c:\temp" | |
choco install office365business --cacheLocation="c:\temp" | |
cinst pingplotter --cacheLocation="c:\temp" | |
cinst powershell-core --cacheLocation="c:\temp" | |
cinst procmon --cacheLocation="c:\temp" | |
cinst tailblazer --ignore-checksums --cacheLocation="c:\temp" | |
cinst azure-data-studio --cacheLocation="c:\temp" | |
choco install microsoft-edge --cacheLocation="c:\temp" | |
cinst procmon --cacheLocation="c:\temp" | |
# https://github.com/matt9ucci/DockerCompletion | |
Write-Host "DockerCompletion" | |
Install-Module DockerCompletion -Force | |
Install-Module posh-git -Force | |
# .NET | |
Write-Host "Temp: $($env:temp)" | |
# .NET | |
choco install dotnet4.5 --cacheLocation="c:\temp" | |
choco install dotnet4.6 --cacheLocation="c:\temp" | |
choco install dotnet4.6.1 --cacheLocation="c:\temp" | |
choco install dotnet4.6.2 --cacheLocation="c:\temp" | |
choco install dotnet4.7 --cacheLocation="c:\temp" | |
choco install dotnet4.7.1 --cacheLocation="c:\temp" | |
choco install dotnetfx --version 4.7.2.20180712 -m --cacheLocation="c:\temp" | |
choco install netfx-4.5.1-devpack --cacheLocation="c:\temp" | |
choco install netfx-4.5.2-devpack --cacheLocation="c:\temp" | |
choco install netfx-4.6.1-devpack --cacheLocation="c:\temp" | |
choco install netfx-4.7-devpack --cacheLocation="c:\temp" | |
choco install netfx-4.7.1-devpack --cacheLocation="c:\temp" | |
choco install netfx-4.7.2-devpack --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 1.1.14 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.105 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.202 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.302 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.403 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.508 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.605 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.1.701 -m --cacheLocation="c:\temp" # 2.1 for VS2019 | |
choco install dotnetcore-sdk --version 2.1.801 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.2.108 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.2.205 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 2.2.301 -m --cacheLocation="c:\temp" # 2.2 for VS2019 | |
choco install dotnetcore-sdk --version 2.2.401 -m --cacheLocation="c:\temp" | |
choco install dotnetcore-sdk --version 3.0.103 -m --cacheLocation="c:\temp" # 3.0 for VS2019 | |
choco install dotnetcore-sdk --version 3.1.101 -m --cacheLocation="c:\temp" # 3.0 for VS2019 | |
choco pin add -n=dotnetcore-sdk # Pin to avoid upgrade uninstalling all these versions! | |
# TURN ON STUFF | |
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions | |
Set-TaskbarOptions -Size Small -Dock Bottom -Combine Full -Lock | |
Set-TaskbarOptions -Size Small -Dock Bottom -Combine Full -AlwaysShowIconsOn | |
# Dark Theme for Windows | |
If (-Not (Test-Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize)) { | |
New-Item -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes -Name Personalize | Out-Null | |
} | |
Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 0 | |
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 0 | |
# To Restore (Light Theme): | |
#Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 1 | |
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize -Name AppsUseLightTheme -Type DWord -Value 1 | |
#--- Restore Temporary Settings --- | |
Enable-UAC | |
Enable-MicrosoftUpdate | |
Install-WindowsUpdate -acceptEula | |
#--- Rename the Computer --- | |
# Requires restart, or add the -Restart flag | |
$computername = "wickdninja" | |
if ($env:computername -ne $computername) { | |
Rename-Computer -NewName $computername | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment