Skip to content

Instantly share code, notes, and snippets.

@splch
Last active December 17, 2023 04:57
Show Gist options
  • Save splch/9832e341e4f636eab29370d284d13481 to your computer and use it in GitHub Desktop.
Save splch/9832e341e4f636eab29370d284d13481 to your computer and use it in GitHub Desktop.
Windows setup script
# Check for Administrator Privileges
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "This script requires Administrator privileges. Please run it as an Administrator."
Exit
}
# Run as Administrator
Set-ExecutionPolicy Bypass -Scope Process -Force -Confirm:$false
# Install Chocolatey
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
try {
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
} catch {
Write-Host "Failed to install Chocolatey. Error: $_"
Exit
}
# Ensure Chocolatey is installed
$chocoPath = $env:ChocolateyInstall
if ($chocoPath -eq $null) {
Write-Host "Chocolatey installation failed. Exiting."
Exit
}
# Refresh environment variables to include Chocolatey
$env:Path = [System.Environment]::GetEnvironmentVariable('Path', 'Machine')
# Install applications with Chocolatey
choco install docker-desktop, firefox, vscodium, git, postman, anaconda3, libreoffice, gimp, audacity, vlc, steam, unity, blender, obs-studio, zoom, virtualbox, 7zip, putty -y
Write-Host "Setup completed successfully."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment