Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Boxstarter Commands for a new Windows box.
# Run this boxstarter by calling the following from an **elevated** command-prompt:
# start http://boxstarter.org/package/url?https://gist.githubusercontent.com/mrichards42/fa7eb6dbb5994855552a1d964d4754de/raw
#------------------------------------------------------------------------------
# TEMPORARY
#------------------------------------------------------------------------------
Disable-UAC
#------------------------------------------------------------------------------
# Uninstall unnecessary applications that come with Windows out of the box
#------------------------------------------------------------------------------
# To list store apps: Get-AppxPackage | sort -property Name | Select-Object Name, PackageFullName, Version | Format-Table -AutoSize
# Microsoft junk
Get-AppxPackage Microsoft.*3D* | Remove-AppxPackage
Get-AppxPackage Microsoft.*advertising* | Remove-AppxPackage
Get-AppxPackage Microsoft.Bing* | Remove-AppxPackage
Get-AppxPackage Microsoft.CommsPhone | Remove-AppxPackage
Get-AppxPackage Microsoft.Getstarted | Remove-AppxPackage
Get-AppxPackage Microsoft.Messaging | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftOfficeHub | Remove-AppxPackage
Get-AppxPackage Microsoft.MicrosoftStickyNotes | Remove-AppxPackage
Get-AppxPackage Microsoft.Office.OneNote | Remove-AppxPackage
Get-AppxPackage Microsoft.Office.Sway | Remove-AppxPackage
Get-AppxPackage Microsoft.OneConnect | Remove-AppxPackage
Get-AppxPackage Microsoft.People | Remove-AppxPackage
Get-AppxPackage Microsoft.SkypeApp | Remove-AppxPackage
Get-AppxPackage Microsoft.Wallet | Remove-AppxPackage
Get-AppxPackage Microsoft.Windows.Photos | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsAlarms | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsFeedbackHub | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsMaps | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsPhone | Remove-AppxPackage
Get-AppxPackage Microsoft.WindowsSoundRecorder | Remove-AppxPackage
Get-AppxPackage microsoft.windowscommunicationsapps | Remove-AppxPackage
Get-AppxPackage Microsoft.Xbox* | Remove-AppxPackage
Get-AppxPackage Microsoft.Zune* | Remove-AppxPackage
# Misc
Get-AppxPackage *Autodesk* | Remove-AppxPackage
Get-AppxPackage *Spotify* | Remove-AppxPackage
# Junk games
Get-AppxPackage king.com.* | Remove-AppxPackage
Get-AppxPackage *disney* | Remove-AppxPackage
Get-AppxPackage *MarchofEmpires* | Remove-AppxPackage
Get-AppxPackage *Solitaire* | Remove-AppxPackage
# Stuff left from the original gist that's not on my machine ... doesn't hurt to keep it anyways
Get-AppxPackage *Dell* | Remove-AppxPackage
Get-AppxPackage *Dropbox* | Remove-AppxPackage
Get-AppxPackage *Facebook* | Remove-AppxPackage
Get-AppxPackage *Keeper* | Remove-AppxPackage
Get-AppxPackage *McAfee* | Remove-AppxPackage
Get-AppxPackage *Minecraft* | Remove-AppxPackage
Get-AppxPackage *Netflix* | Remove-AppxPackage
Get-AppxPackage *Plex* | Remove-AppxPackage
Get-AppxPackage *Twitter* | Remove-AppxPackage
# Uninstall McAfee Security App
$mcafee = gci "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" | foreach { gp $_.PSPath } | ? { $_ -match "McAfee Security" } | select UninstallString
if ($mcafee) {
$mcafee = $mcafee.UninstallString -Replace "C:\Program Files\McAfee\MSC\mcuihost.exe",""
Write "Uninstalling McAfee..."
start-process "C:\Program Files\McAfee\MSC\mcuihost.exe" -arg "$mcafee" -Wait
}
#------------------------------------------------------------------------------
# Windows Settings
#------------------------------------------------------------------------------
Disable-BingSearch
Disable-GameBarTips
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Set-TaskbarOptions -Dock Bottom -Combine Full -Lock -AlwaysShowIconsOn
# Update power schemes
foreach ($line in (powercfg -list)[3..10]) {
$guid = $line.split()[3]
if ($guid) {
# Lid does nothing
powercfg -setacvalueindex $guid SUB_BUTTONS LIDACTION 0
powercfg -setdcvalueindex $guid SUB_BUTTONS LIDACTION 0
# Power button hibernates
powercfg -setacvalueindex $guid SUB_BUTTONS PBUTTONACTION 2
powercfg -setdcvalueindex $guid SUB_BUTTONS PBUTTONACTION 2
}
}
# 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
# 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
#------------------------------------------------------------------------------
# Windows Features
#------------------------------------------------------------------------------
cuninst WindowsMediaPlayer -source windowsfeatures
#------------------------------------------------------------------------------
# Software
#------------------------------------------------------------------------------
# Tools
cinst ffmpeg
cinst hxd
cinst sqlitebrowser
cinst sysinternals
cinst windirstat
# Libraries/Languages
cinst androidstudio
cinst jre8
cinst jdk8 -params "source=false"
cinst lua
# cinst python2 --params "/InstallDir:C:\\Python27"
# cinst nodejs
# Basic apps
cinst 7zip
cinst firefox
cinst foobar2000
cinst googlechrome
cinst irfanview -params "/group=1 /assoc=1"
cinst irfanviewplugins
cinst libreoffice-fresh
cinst notepadplusplus
cinst pidgin
cinst skype
cinst vlc
# Special case apps
cinst audacity
cinst audacity-lame
cinst calibre
# These need to be installed by hand -- maybe make a separate package?
# -------
# digicamcontrol
# frescobaldi
# genymotion
# mp3splt
# vmpk
# Other maybes
# ------------
# cinst avastfreeantivirus
# cinst eac
# cinst f.lux
# cinst filezilla
# cinst inkscape
# cinst launchy
# cinst malwarebytes
# cinst stellarium
# cinst thundirbird
# cinst virtualbox --params "/NoQuickLaunch /NoDesktopShortcut"
#------------------------------------------------------------------------------
# Taskbar shortcuts
#------------------------------------------------------------------------------
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles}\Mozilla Firefox\firefox.exe"
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles(x86)}\foobar2000\foobar2000.exe"
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles}\Notepad++\notepad++.exe"
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles}\LibreOffice 5\program\swriter.exe"
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles(x86)}\IrfanView\i_view32.exe"
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles}\VideoLAN\VLC\vlc.exe"
Install-ChocolateyPinnedTaskBarItem "${env:windir}\system32\taskmgr.exe /7"
Install-ChocolateyPinnedTaskBarItem "${env:ProgramFiles}\Google\Chrome\Application\chrome.exe"
#------------------------------------------------------------------------------
# Restore Temporary Settings
#------------------------------------------------------------------------------
Enable-UAC
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula
#------------------------------------------------------------------------------
# WSL / Ubuntu
#------------------------------------------------------------------------------
cinst Microsoft-Windows-Subsystem-Linux -source windowsfeatures
# see https://docs.microsoft.com/en-us/windows/wsl/install-on-server
# This requires user interaction to enter the new account's un/pw, so it's last
iwr -Uri https://aka.ms/wsl-ubuntu-1604 -OutFile ~/Ubuntu.zip
Expand-Archive ~/Ubuntu.zip ~/Ubuntu
~/Ubuntu/ubuntu.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment