|
# no-bullshit-win11.ps1 |
|
# Run this in an elevated PowerShell window (Run as administrator). |
|
|
|
Write-Host "=== Windows 11 De-bullshit Script ===" -ForegroundColor Cyan |
|
|
|
#----------------------------------------- |
|
# 0. Ensure we're running as Administrator |
|
#----------------------------------------- |
|
$principal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent()) |
|
if (-not $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { |
|
Write-Error "Run this script in an elevated PowerShell window (Run as administrator)." |
|
exit 1 |
|
} |
|
|
|
#------------------------------------------------------------------- |
|
# 1. System-wide telemetry & consumer crap (HKLM\Policies) |
|
#------------------------------------------------------------------- |
|
|
|
Write-Host "[1/6] Tightening telemetry and consumer features..." -ForegroundColor Yellow |
|
|
|
# Telemetry: 0 = Security, 1 = Basic, 2 = Enhanced, 3 = Full |
|
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Force | Out-Null |
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" ` |
|
-Name "AllowTelemetry" -PropertyType DWord -Value 0 -Force | Out-Null |
|
|
|
# Turn off Microsoft consumer experience / suggested apps, ads, “fun” stuff |
|
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null |
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" ` |
|
-Name "DisableWindowsConsumerFeatures" -PropertyType DWord -Value 1 -Force | Out-Null |
|
|
|
# Hide Recommended section in Start (where supported) |
|
New-Item -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start" -Force | Out-Null |
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\PolicyManager\current\device\Start" ` |
|
-Name "HideRecommendedSection" -PropertyType DWord -Value 1 -Force | Out-Null |
|
|
|
#------------------------------------------------------------------- |
|
# 2. Per-user bullshit: suggestions, ads, tips, “recommended” content |
|
# (HKCU\ContentDeliveryManager & a couple of Explorer knobs) |
|
#------------------------------------------------------------------- |
|
|
|
Write-Host "[2/6] Killing Start/Settings suggestions, Spotlight-style junk..." -ForegroundColor Yellow |
|
|
|
# ContentDeliveryManager controls various “suggested content” and promo stuff |
|
$cdmPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager" |
|
New-Item -Path $cdmPath -Force -ErrorAction SilentlyContinue | Out-Null |
|
|
|
# 0 = disabled |
|
$cdmValues = @{ |
|
"SystemPaneSuggestionsEnabled" = 0 # Suggestions in Start / taskbar |
|
"SubscribedContent-338388Enabled" = 0 # Start menu suggestions |
|
"SubscribedContent-338389Enabled" = 0 # Lock screen suggestions |
|
"SubscribedContent-338393Enabled" = 0 # Suggested content in Settings |
|
"SubscribedContent-353694Enabled" = 0 # More Settings suggestions |
|
"SubscribedContent-353696Enabled" = 0 |
|
"SubscribedContent-353698Enabled" = 0 |
|
} |
|
|
|
foreach ($item in $cdmValues.GetEnumerator()) { |
|
New-ItemProperty -Path $cdmPath -Name $item.Key -PropertyType DWord -Value $item.Value -Force -ErrorAction SilentlyContinue | Out-Null |
|
} |
|
|
|
# Stop Start menu from tracking frequently used programs (if key exists) |
|
$advPath = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" |
|
if (Test-Path $advPath) { |
|
Set-ItemProperty -Path $advPath -Name "Start_TrackProgs" -Type DWord -Value 0 -ErrorAction SilentlyContinue |
|
} else { |
|
Write-Host " - Explorer\\Advanced key not found in HKCU, skipping Start_TrackProgs tweak." |
|
} |
|
|
|
#------------------------------------------------------------------- |
|
# 3. Disable some telemetry-related services |
|
#------------------------------------------------------------------- |
|
|
|
Write-Host "[3/6] Disabling telemetry services (where present)..." -ForegroundColor Yellow |
|
|
|
$services = @( |
|
"DiagTrack", # Connected User Experiences and Telemetry |
|
"dmwappushservice" # WAP Push Message Routing Service |
|
) |
|
|
|
foreach ($svcName in $services) { |
|
$svc = Get-Service -Name $svcName -ErrorAction SilentlyContinue |
|
if ($svc) { |
|
try { |
|
if ($svc.Status -ne "Stopped") { |
|
Stop-Service -Name $svcName -Force -ErrorAction SilentlyContinue |
|
} |
|
Set-Service -Name $svcName -StartupType Disabled -ErrorAction SilentlyContinue |
|
Write-Host " - Disabled service $svcName" |
|
} catch { |
|
Write-Warning " ! Failed to change service $svcName : $($_.Exception.Message)" |
|
} |
|
} |
|
} |
|
|
|
#------------------------------------------------------------------- |
|
# 4. Remove Widgets / News feed (Web Experience Pack) |
|
#------------------------------------------------------------------- |
|
|
|
Write-Host "[4/6] Removing Widgets / News feed (Web Experience Pack)..." -ForegroundColor Yellow |
|
|
|
try { |
|
$webExpPkgs = Get-AppxPackage -AllUsers | Where-Object { $_.Name -like "*WebExperience*" } |
|
foreach ($pkg in $webExpPkgs) { |
|
Write-Host " - Removing $($pkg.Name) for all users..." |
|
Remove-AppxPackage -Package $pkg.PackageFullName -AllUsers -ErrorAction SilentlyContinue |
|
} |
|
} catch { |
|
Write-Warning " ! Failed to remove Windows Web Experience Pack: $($_.Exception.Message)" |
|
} |
|
|
|
#------------------------------------------------------------------- |
|
# 5. Remove preinstalled junk / nagware apps |
|
# (Office hub, Teams consumer, Xbox, News, Clipchamp, etc.) |
|
#------------------------------------------------------------------- |
|
|
|
Write-Host "[5/6] Removing preinstalled junk apps..." -ForegroundColor Yellow |
|
|
|
# Patterns for common crap. Non-matches are harmless. |
|
$appPatterns = @( |
|
"Microsoft.MicrosoftOfficeHub", # Microsoft 365 / Office hub |
|
"Microsoft.WindowsFeedbackHub", # Feedback hub |
|
"Microsoft.Xbox*", # Xbox everything |
|
"Microsoft.GamingApp", # Xbox app |
|
"Microsoft.GetHelp", |
|
"Microsoft.Getstarted", |
|
"Microsoft.Todos", |
|
"Microsoft.BingNews", |
|
"Microsoft.News", |
|
"Clipchamp.Clipchamp", |
|
"Microsoft.OutlookForWindows", |
|
"MicrosoftTeams", # Consumer Teams |
|
"Microsoft.SkypeApp" |
|
) |
|
|
|
foreach ($pattern in $appPatterns) { |
|
$pkgs = Get-AppxPackage -AllUsers | Where-Object { $_.Name -like $pattern } |
|
foreach ($pkg in $pkgs) { |
|
try { |
|
Write-Host " - Removing $($pkg.Name) for all users..." |
|
Remove-AppxPackage -Package $pkg.PackageFullName -AllUsers -ErrorAction SilentlyContinue |
|
} catch { |
|
Write-Warning " ! Failed to remove $($pkg.Name): $($_.Exception.Message)" |
|
} |
|
} |
|
} |
|
|
|
#------------------------------------------------------------------- |
|
# 6. Optional: soften Edge / OneDrive presence (NOT full removal) |
|
# (Full removal is messy and often undone by updates) |
|
#------------------------------------------------------------------- |
|
|
|
Write-Host "[6/6] (Optional) Hiding some OneDrive/Edge noise..." -ForegroundColor Yellow |
|
|
|
# Disable OneDrive from starting automatically for this user (doesn't uninstall) |
|
$runKey = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" |
|
if (Test-Path $runKey) { |
|
Get-ItemProperty -Path $runKey | ForEach-Object { |
|
$_.PSObject.Properties | Where-Object { $_.Name -like "*OneDrive*" } | ForEach-Object { |
|
Write-Host " - Removing OneDrive auto-start entry: $($_.Name)" |
|
Remove-ItemProperty -Path $runKey -Name $_.Name -ErrorAction SilentlyContinue |
|
} |
|
} |
|
} |
|
|
|
# NOTE: If you really want to *uninstall* OneDrive or Edge, you can do it manually, e.g.: |
|
# winget uninstall "Microsoft OneDrive" |
|
# winget uninstall "Microsoft Edge" |
|
# but both tend to get resurrected by Windows Update and can break random flows. |
|
# I'm leaving them out of the automatic script on purpose. |
|
|
|
Write-Host "" |
|
Write-Host "=== Done. Reboot is recommended to apply everything. ===" -ForegroundColor Green |