Skip to content

Instantly share code, notes, and snippets.

@getchoo
Last active January 30, 2026 11:43
Show Gist options
  • Select an option

  • Save getchoo/b141bf86896a8cfcc4a5068976729833 to your computer and use it in GitHub Desktop.

Select an option

Save getchoo/b141bf86896a8cfcc4a5068976729833 to your computer and use it in GitHub Desktop.
my post-install script for windows 11
<#
.SYNOPSIS
post-install script for my windows machines
.DESCRIPTION
sets up apps via winget and scoop, removes default apps, and sets some services to manual
.NOTES
inspired by https://gist.github.com/mikepruett3/7ca6518051383ee14f9cf8ae63ba18a7
#>
$VerbosePreference = "Continue"
function Add-Registry-Key {
param (
[String]$Name,
[String]$Path,
[Microsoft.Win32.RegistryValueKind]$Type,
[System.Object]$Value
)
Write-Verbose -Message "Adding registry key $Path\$NAME"
if (-not(Test-Path -Path $Path)) {
Write-Verbose -Message "Creating registry path $Path"
New-Item -Path $Path -Force
}
New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force
}
function Add-HKLM-Key {
param (
[String]$Name,
[String]$Path,
[Microsoft.Win32.RegistryValueKind]$Type,
[System.Object]$Value
)
Add-Registry-Key -Path "HKLM:\$Path" -Name $Name -Value $Value -Type $Type
}
function Add-HKCU-Key {
param (
[String]$Name,
[String]$Path,
[Microsoft.Win32.RegistryValueKind]$Type,
[System.Object]$Value
)
Add-Registry-Key -Path "HKCU:\$Path" -Name $Name -Value $Value -Type $Type
}
function Remove-Default-Package {
param (
[String]$Name
)
Write-Verbose -Message "Removing default package $Name"
Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -Like $Name} | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName}
Write-Verbose -Message "Removing $Name from current user"
Get-AppxPackage $Name | Remove-AppxPackage
}
function Install-Winget-Package {
param (
[String]$Package
)
if (! (winget list --exact -q $Package --accept-source-agreements --accept-package-agreements) ) {
Write-Verbose -Message "Installing $Package with winget"
winget install --exact --silent $Package
} else {
Write-Verbose -Message "Winget package $Package is already installed! Skipping"
}
}
function Install-Scoop-Package {
param (
[String]$Package
)
if (! (scoop info $Package).Installed ) {
Write-Verbose -Message "Installing $Package with scoop"
scoop install $Package
} else {
Write-Verbose -Message "Scoop package $Package is already installed! Skipping"
}
}
function Get-File {
param (
[String]$Output,
[String]$URL
)
Write-Versboe -Message "Downloading file from $URL"
Invoke-Webrequest -Uri $URL -OutFile $Output
}
function Install-From-File {
param (
[String]$Output,
[String]$Path
)
Get-File -Output $Path -URL $URL
if (Test-Path -Path $Path) {
Start-Process -FilePath $Path
Remove-Item -Path $Path
} else {
Write-Verbose -Message "$Path was not found! Skipping"
}
}
# actual start of the script :p
Write-Host "Starting post-install script!"
# --- Privacy/Usability Settings ---
# see https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services
## Disable Cortana and Web Search
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -Type DWord -Value 0
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowSearchToUseLocation" -Type DWord -Value 0
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "ConnectedSearchUseWeb" -Type DWord -Value 0
## Disable OneDrive
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1
Add-HKLM-Key -Path "SOFTWARE\Microsoft\OneDrive" -Name "PreventNetworkTrafficPreUserSignIn" -Type DWord -Value 1
## Disable Advertising ID
Add-HKLM-Key -Path "SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Type DWord -Value 1
Add-HKLM-Key -Path "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackProgs" -Type DWord -Value 0
## Disable apps' access to some things
$app_access = @(
"LetAppsAccessLocation"
"LetAppsAccessContacts"
"LetAppsAccessCalendar"
"LetAppsAccessCallHistory"
"LetAppsAccessEmail"
"LetAppsAccessMessaging"
"LetAppsAccessPhone"
"LetAppsAccessMotion"
"LetAppsAccessTasks"
"LetAppsGetDiagnosticInfo"
"LetAppsActivateWithVoice"
"LetAppsActivateWithVoiceAboveLock"
)
foreach ($access in $app_access) {
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" -Name $access -Type DWord -Value 2
}
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\Messaging" -Name "AllowMessageSync" -Type DWord -Value 0
## Disable Feedback & diagnostics
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Type DWord -Value 1
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
Add-HKCU-Key -Path "SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Type DWord -Value 1
## Disable Inking & Typing data collection
Add-HKCU-Key -Path "SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1
Add-HKCU-Key -Path "SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1
## Disable Activity History
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 0
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 0
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value 0
## Disable Windows Defender sample submission
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SubmitSamplesConsent" -Type DWord -Value 2
## Disable News and interests
Add-HKLM-Key -Path "SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type DWord -Value 0
## Disable Personalized Experiences
Add-HKCU-Key -Path "SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsSpotlightFeatures" -Type DWord -Value 1
Add-HKCU-Key -Path "SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableCloudOptimizedContent" -Type DWord -Value 1
# --- Remove Default Packages ---
$packages = @(
"Microsoft.BingNews"
"Microsoft.BingWeather"
"Microsoft.BingFinance"
"Microsoft.BingSports"
"*.Twitter"
"Microsoft.Office.Sway"
"Microsoft.Office.OneNote"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.SkypeApp"
"Microsoft.MicrosoftStickyNotes"
)
foreach ($pkg in $packages) {
Remove-Default-Package -Name $pkg
}
# --- Disable Extra Services ---
## sourced from https://github.com/ChrisTitusTech/winutil
$services = @(
"AJRouter"
"Browser"
"BthAvctpSvc"
"diagnosticshub.standardcollector.service"
"DiagTrack"
"Fax"
"fhsvc"
"lmhosts"
"PhoneSvc"
"RemoteAccess"
"RemoteRegistry"
"RetailDemo"
# "wisvc" # Windows Insider
"WMPNetworkSvc"
"WPDBusEnum"
)
foreach ($service in $services) {
Write-Verbose -Message "Disabling $service"
Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Manual -ErrorAction SilentlyContinue
}
# --- Stop here if you want ---
if ( $(Read-Host -Prompt "Do you want to install packages through winget and scoop? [y/n]?") -eq "n") {
Write-Host "Done!"
Exit
}
# --- Setup WinGet Packages ---
## install winget if it's not already
## https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901
if (! (Get-AppxPackage -Name "Microsoft.DesktopAppInstaller") ) {
Write-Verbose -Message "Installing winget"
$releases_url = "https://api.github.com/repos/microsoft/winget-cli/releases/latest"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$releases = Invoke-RestMethod -uri "$($releases_url)"
$latestRelease = $releases.assets | Where-Object { $_.browser_download_url.EndsWith("msixbundle") } | Select-Object -First 1
Add-AppxPackage -Path $latestRelease.browser_download_url
}
$winget_packages = @(
"Discord.Discord"
"ElectronicArts.EADesktop"
"Elgato.CameraHub"
"EpicGames.EpicGamesLauncher"
"voidtools.Everything"
"valinet.ExplorerPatcher"
"Gajim.Gajim"
"RyanGregg.GCFScape"
"GOG.Galaxy"
"Hibbiki.Chromium"
"LOOT.LOOT"
"M2Team.NanaZip"
"Mozilla.Firefox"
"Mojang.MinecraftLauncher"
"Microsoft.VisualStudio.2022.BuildTools"
"MullvadVPN.MullvadVPN"
"Jaquadro.NBTExplorer"
"nomacs.nomacs"
"Notepad++.Notepad++"
"TechPowerUp.NVCleanstall"
"OBSProject.OBSStudio"
"namazso.OpenHashTab"
"Microsoft.PowerShell"
"Microsoft.PowerToys"
"PrismLauncher.PrismLauncher"
"qBittorrent.qBittorrent"
"Valve.Steam"
"Ubisoft.Connect"
"OneGal.Viper"
"VideoLAN.VLC"
"Microsoft.VisualStudioCode"
"RyanGregg.VTFEdit"
)
foreach ($pkg in $winget_packages) {
Install-Winget-Package -Package $pkg
}
# --- Setup Scoop Packages ---
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
## install scoop if it isn't already
if ( !(Get-Command -Name "scoop" -CommandType Application -ErrorAction SilentlyContinue | Out-Null) ) {
Write-Verbose -Message "Installing Scoop"
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh'))
}
$scoop_packages = @(
"git"
"7-zip"
"cemu"
"crispy-doom"
"deno"
"dolphin"
"dust"
"element"
"fd"
"ffmpeg"
"filelight"
"fnm"
"gh"
"gpg"
"handbrake"
"hwinfo"
"jq"
"just"
"kdenlive"
"magic-wormhole"
"meson"
"neovim"
"openrgb"
"pnpm"
"python"
"rclone"
"restic"
"retroarch"
"ripgrep"
"rustup-msvc"
"sccache"
"smartmontools"
"temurin17-jdk"
"temurin8-jre"
"yt-dlp"
"yuzu"
)
foreach ($pkg in $scoop_packages) {
Install-Scoop-Package -Package $pkg
}
# --- Install external apps ---
$file = New-TemporaryFile
Remove-Item -Path $file -Force
$temp_folder = New-Item -ItemType Directory -Path "$($ENV:Temp)\$($file.Name)"
Install-From-File -Output "$temp_folder/OpenJDK16U-jdk_x64_windows_hotspot_16.0.2_7.msi" -URL "https://github.com/adoptium/temurin16-binaries/releases/download/jdk-16.0.2%2B7/OpenJDK16U-jdk_x64_windows_hotspot_16.0.2_7.msi"
Install-From-File -Output "$temp_folder/qt-unified-windows-x64-online.exe" -URL "https://download.qt.io/official_releases/online_installers/qt-unified-windows-x64-online.exe"
Get-File -Output "$HOME/Downloads/rpcs3-v0.0.25-14495-8ac99680_win64.7z" -URL "https://github.com/RPCS3/rpcs3-binaries-win/releases/download/build-8ac99680962fc4c01dd561716f0b927d386bc7e8/rpcs3-v0.0.25-14495-8ac99680_win64.7z"
Install-From-File -Output "$temp_folder/Slippi-Launcher-Setup-2.7.0.exe" -URL "https://github.com/project-slippi/slippi-launcher/releases/download/v2.7.0/Slippi-Launcher-Setup-2.7.0.exe"
Write-Host "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment