For various reasons, I’ve had to set up new computers a few times lately. This is still a time-consuming task that I try to avoid, but as I’ve been automating more and more of the process, it’s getting faster and more consistent. This post is essentially a note to my future self, or any colleagues that want to use this as their baseline for their own setups.

Many of the tools I use are free and open source, but some of them are not. Make sure to review and purchase licences where you need to. I’ve used most of these things fairly heavily, and am comfortable recommending all of them. It’s also easy to remove anything you don’t want to use.

I start with these commands because it makes the rest of the script easier to run. Windows Terminal is more comfortable for running lots of scripts, and BitWarden is my password manager of choice. Obsidian is the app where I keep my copy of these instructions, and Notepad++ is always helpful. Run this as administrator in whatever terminal application is available:

1
2
3
winget install --id chocolatey.chocolatey --source winget
winget install --id Microsoft.Powershell --source winget
choco install -y microsoft-windows-terminal bitwarden obsidian notepadplusplus

My next step is to config Windows Terminal and pin it to the taskbar. I make PowerShell (the newer Core version) the default. I also make a clone that includes the “Run as Administrator” option. This makes it a little easier to run administrative scripts. I also make these the first two options in the list, but it currently requires editing the settings file.

After this, I can do most of the setup with a few commands. I’ve used a group of PowerShell variables and expansion operators to group the apps I install. It’s better to run one choco command with everything than to run a bunch of separate ones (less fussing while it does its business). It should be straigtforward to understand how these work if you want to add/remove items or entire sections

Next, and now in Windows Terminal, PowerShell, as administrator, I run:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
winget install -e --id Google.Chrome
winget install -e --id WinDirStat.WinDirStat

$hardware = @("razer-synapse-3", "logitech-options", "samsung-magician")
$utilities = @("Firefox", "restic", "7zip", "irfanview", "irfanviewplugins", "vlc", "winscp")
$editors = @("scrivener", "paint.net", "audacity", "inkscape")
$entertainment = @("spotify", "steam", "epicgameslauncher")
$development = @("git", "git-lfs", "dotnet-sdk-9", "podman-cli", "jetbrains-rider", "webstorm", "Python", "dbeaver", "beyondcompare", "nvm", "awscli", "jq")
$misc = @("zoom", "veracrypt", "calibre")

choco install -y @hardware @utilities @editors @entertainment @development @misc

# show hidden files and file extensions
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Hidden" -Value 1
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "HideFileExt" -Value 0

# This disables the incredibly annoying Ctrl+Shift and Left Alt + Shift input language hotkeys
New-ItemProperty "HKCU:\Keyboard Layout\Toggle" -Name 'Language Hotkey' -Value 3 -PropertyType String -Force
New-ItemProperty "HKCU:\Keyboard Layout\Toggle" -Name 'Hotkey' -Value 3 -PropertyType String -Force
New-ItemProperty "HKCU:\Keyboard Layout\Toggle" -Name 'Layout Hotkey' -Value 3 -PropertyType String -Force

# Add Roaming binary folder (in OneDrive) to my Path variable. I keep a few utilities in this directory such as Procmon64, and a couple of PowerShell scripts I like to keep handy
$UserPath = [System.Environment]::GetEnvironmentVariable('PATH', [System.EnvironmentVariableTarget]::User) | Out-String -NoNewline
if ($UserPath -notmatch 'OneDrive\\Roaming\\WindowsBin')
{
if ($UserPath -notmatch ';') { $UserPath += ';' }
$UserPath += '%USERPROFILE%\OneDrive\Roaming\WindowsBin;'
[System.Environment]::SetEnvironmentVariable('PATH', $UserPath, [System.EnvironmentVariableTarget]::User)
}

# More Development stuff
wsl --install
dotnet dev-certs https --trust

Install-Module -Force posh-git
Install-Module -Name AWS.Tools.Installer
Install-AWSToolsModule AWS.Tools.EC2,AWS.Tools.S3

git config --global user.email REDACTED@users.noreply.github.com
git config --global user.name Jesse
git config --global diff.tool bc
git config --global difftool.bc.path 'c:/Program Files/Beyond Compare 5/bcomp.exe'
git config --global merge.tool bc
git config --global mergetool.bc.path 'c:/Program Files/Beyond Compare 5/bcomp.exe'
git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

# Add some aliases and adjust some settings in my PowerShell profile
New-Item -Type Directory -Path (Split-Path $PROFILE) -Force
"
New-Alias npp 'C:\Program Files\Notepad++\notepad++.exe'
New-Alias bc 'C:\Program Files\Beyond Compare 5\BComp.exe'
New-Alias ll Get-ChildItem

Import-Module posh-git
`$GitPromptSettings.EnableFileStatus = `$false

Import-Module PSReadLine" | Out-File $PROFILE -NoClobber

After this, there are still a few manual steps I take. I could probably automate these, but I haven’t yet:

  • Ensure BitLocker is enabled, and back up the recovery keys in my password manager.
  • Set OneDrive to download all files locally
  • Adjust keyboard layout settings as I like them
  • Put a shortcut for Borderline on the Task Bar. It is a little utility that moves and/or resizes any windows that are outside or across monitor boundaries. This is unfortunately common when running an external display and multiple scale factors.
  • Adjust Power & battery settings:
    • Turn my screen off after: 10 minutes
    • When plugged in, make my device sleep: Never
  • Restore the following files and directories:
    • $HOME\.ssh
    • $HOME\Downloads
    • $HOME\AppData\Roaming\Notepad++\shortcuts.xml
    • C:\Windows\System32\drivers\etc\hosts
  • Set up my backup system and test that it’s working
  • Set a reminder to clean up backups for any retired systems after a couple of months