Skip to content

Instantly share code, notes, and snippets.

@adamrushuk
Last active July 14, 2021 07:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamrushuk/0ebd813368796e6a0554c2c3891490fd to your computer and use it in GitHub Desktop.
Save adamrushuk/0ebd813368796e6a0554c2c3891490fd to your computer and use it in GitHub Desktop.
New Computer Configuration Scripts - run each script in order
# Install Boxstarter and Chocolatey
Set-ExecutionPolicy -ExecutionPolicy "RemoteSigned" -Verbose
. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# Set Explorer options
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions -EnableShowFullPathInTitleBar -DisableOpenFileExplorerToQuickAccess -DisableShowRecentFilesInQuickAccess -DisableShowFrequentFoldersInQuickAccess -DisableExpandToOpenFolder -DisableShowRibbon
# Set Taskbar options
Set-TaskbarOptions -Size Large -Lock -Dock Bottom -Combine Always
# Run Chocolatey script in this GIST
Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/adamrushuk/0ebd813368796e6a0554c2c3891490fd/raw/21fceea5ecbed786986a8c3d986e93136d5f8c77/02-Chocolatey.ps1 -DisableReboots
# Installation script used by Boxstarter
# Some lines commented out as not fully tested with Boxstarter on a fresh computer
# Install Chocolatey
# Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Disable confirmations
choco feature enable -n allowGlobalConfirmation
# Antivirus
choco install -y malwarebytes
# Drivers
choco install -y displaylink
# Restart-Computer
# Main applications
choco install -y sysinternals treesizefree cmdermini notepadplusplus.install mremoteng 7zip.install `
lockhunter skype googlechrome slack speccy foxitreader sharex
# Failed on last attempt (keeping separate)
choco install -y spotify evernote
# Restart-Computer
# Dev
# Either choose VirtualBox / Minikube, VirtualBox / Docker Machine, or just Docker Desktop
# choco install -y virtualbox minikube docker docker-compose
# choco install -y virtualbox docker-machine docker-cli
choco install docker-desktop
# Restart-Computer
choco install -y powershell-core terraform packer graphviz git.install vscode azure-cli microsoftazurestorageexplorer `
winscp vagrant nodejs screenshotcaptor jq gh postman lens
# Kubernetes / Docker
choco install -y kubernetes-cli kubernetes-helm
# Gaming
choco install -y discord.install steam
# Pin applications that self-update (stops Chocolatey trying to update)
choco pin add -n=malwarebytes
choco pin add -n=GoogleChrome
choco pin add -n=steam
choco pin add -n=vscode
choco pin add -n=docker-desktop
choco pin add -n=spotify
choco pin add -n=slack
choco pin add -n=notepadplusplus
choco pin add -n=skype
choco pin add -n=malwarebytes
choco pin add -n=kubernetes-helm
choco pin add -n=terraform
choco pin add -n=lens
# Restart-Computer
# Setup PowerShell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
Install-PackageProvider NuGet -MinimumVersion '2.8.5.201' -Force
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
# Install latest PackageManagement modules
Install-Module -Name PackageManagement -Force -Verbose
Install-Module -Name PowerShellGet -Force -Verbose
# Start a new PowerShell session
# Install other modules
$moduleNames = @(
'Az'
'EditorServicesCommandSuite' # You should load this in your PowerShell profile for VSCode
'Pester'
'posh-git'
'PSScriptAnalyzer'
'PSReadLine'
)
Install-Module -Name $moduleNames -Force -Verbose
#Requires -RunAsAdministrator
# Setup SSH / Git
# Vars
$name = 'Adam Rush'
$emailAddress = 'user@domain.com'
$sshClientPath = 'C:/Windows/System32/OpenSSH/ssh.exe'
# Check and add OpenSSH Client
Get-WindowsCapability -Online -Name 'OpenSSH.Client*'
Add-WindowsCapability -Online -Name 'OpenSSH.Client*'
# Set SSH Agent to auto-start
# WARNING: disabled as this service may not be required if only using default "id_rsa" keys in ~\.ssh
# Set-Service -Name 'ssh-agent' -StartupType 'Automatic' -Verbose
# Start-Service -Name 'ssh-agent' -Verbose
# Configure global Git settings
git config --global user.name "$name"
git config --global user.email "$emailAddress"
git config --global core.ignorecase false
git config --global core.autocrlf false
if (Test-Path -Path $sshClientPath) {
git config --global core.sshcommand "$sshClientPath"
}
# Show new global Git settings
git config --global -l
# Create a new SSH key if required
$privSshKeyPath = Join-Path -Path $env:USERPROFILE -ChildPath '\.ssh\id_rsa'
if (-not (Test-Path -Path $privSshKeyPath)) {
# Generate new RSA key
ssh-keygen -t rsa -b 4096 -C $emailAddress -f $privSshKeyPath
}
# Copy the public key into clipboard ready to paste into Git services (GitHub / Azure DevOps)
$publicSshKeyPath = "$privSshKeyPath.pub"
Get-Content -Path $publicSshKeyPath | clip
Write-Host "Public SSH key [$publicSshKeyPath] copied to clipboard, ready to paste into Git Services (GitHub / Azure DevOps):"
Write-Host "https://github.com/settings/ssh/new"
Write-Host "https://dev.azure.com/<MYUSERNAME>/_usersSettings/keys"
Write-Host "`nRun 'ssh -T git@github.com' to test connection once ready."
# Install VSCode extensions
$vsCodeExtensionNames = @(
"aaron-bond.better-comments"
"albymor.increment-selection"
"bierner.markdown-preview-github-styles"
"bungcip.better-toml"
"CoenraadS.bracket-pair-colorizer-2"
"DavidAnson.vscode-markdownlint"
"eamodio.gitlens"
"formulahendry.code-runner"
"joshuapoehls.json-escaper"
"ivory-lab.jenkinsfile-support"
"karigari.chat"
"marcostazi.VS-code-vagrantfile"
"mauve.terraform"
"ms-azure-devops.azure-pipelines"
"ms-azuretools.vscode-azureterraform"
"ms-vscode-remote.remote-containers"
"ms-vscode-remote.remote-ssh"
"ms-vscode-remote.remote-ssh-edit"
"ms-vscode-remote.remote-ssh-explorer"
"ms-vscode-remote.remote-wsl"
"ms-vscode-remote.vscode-remote-extensionpack"
"ms-vscode.azure-account"
"ms-vscode.azurecli"
"ms-vscode.csharp"
"ms-vscode.powershell"
"ms-vscode.powershell-preview"
"nickdemayo.vscode-json-editor"
"redhat.vscode-yaml"
"samuelcolvin.jinjahtml"
"Shan.code-settings-sync"
"shanoor.vscode-nginx"
"sidneys1.gitconfig"
"Tyriar.shell-launcher"
"vscode-icons-team.vscode-icons"
"vscoss.vscode-ansible"
"wengerk.highlight-bad-chars"
"yzhang.markdown-all-in-one"
)
$codeCmdPath = (Get-Command -Name "code").Source
foreach ($vsCodeExtensionName in $vsCodeExtensionNames) {
Write-Host "Installing extension $vsCodeExtensionName..." -ForegroundColor 'Gray'
& $codeCmdPath --install-extension $vsCodeExtensionName 2>&1 >> $null
}
<# [OPTIONAL] Opens a browser tab for each extension, so you can manually download them
# currently no way to automate downloading the .vsix files!
$vsCodeExtensionNames | ForEach-Object {Start-Process "https://marketplace.visualstudio.com/items?itemName=$_"}
#>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment