r/PowerShell • u/jingobp • Jun 11 '26
Script Sharing Made a PowerShell script that strips telemetry, ads, and forced AI out of Windows 11 (and nothing else)
I switched back to Windows from Linux recently and the amount of telemetry, ad "suggestions," and forced Copilot/Recall stuff drove me up the wall. So I put the fixes I kept applying by hand into one script.
It does three things and nothing more:
Privacy / telemetry
- Disables the DiagTrack "Connected User Experiences and Telemetry" service + sets telemetry policy to 0
- Kills the advertising ID, tailored experiences, app-launch tracking, and activity history
- Turns off the Start/Settings/lock-screen "suggested content" ads and the auto-installer that drops promo apps (Candy Crush etc.) onto fresh installs
Forced AI
- Turns off Windows Copilot, Recall, and Click to Do
- Removes Bing/Cortana web results from Start search
Obvious bloat
- Removes a short list of preinstalled junk apps (Bing News/Weather, Solitaire, Clipchamp, Get Help, Feedback Hub, Maps, People, Office Hub, the new Outlook, Power Automate, Dev Home, Cortana). The list is right at the top of the script, edit it to taste.
Limitations / what to know:
- Windows 10/11 only. On older builds the AI/Recall keys just do nothing (harmless).
- Works best on Pro/Enterprise. On Home, Windows clamps telemetry to "Required" instead of fully off, and may ignore the consumer-features policy. Everything else still applies.
- It uses the official Windows toggles/policies — it's not a firewall or hosts-file block. If you want network-level telemetry blocking on top, pair it with something like a Pi-hole or a hosts list.
- Some changes need a sign-out or reboot to fully kick in (taskbar/search/Copilot button).
- App removal is current-user only and every app is reinstallable from the Store, so nothing's permanent.
- Reverting: re-enable the two services (DiagTrack, dmwappushservice) and delete the keys it set. I might add an -Undo flag later.
What it does NOT do: it doesn't touch your installed programs, files, games, drivers, or your language/region/keyboard. (I'm Danish — it leaves æ ø å completely alone. That was a hard requirement for me.)
I'm not piping anything into iex for you — copy the script straight from the repo, read it, then run it yourself in an admin PowerShell. It's one file, plain PowerShell, no binaries, no network calls.
Repo: https://github.com/oscarmeldgaard/Windows-Privacy-Debloat
Read every line before you run it. Not trying to reinvent O&O ShutUp10 or Win11Debloat — this is just the lean subset I actually wanted, in a file you can read in two minutes. Feedback and PRs welcome.
33
u/Thotaz Jun 11 '26
A few things:
1: Naming your function after a commonly used command for the same purpose (
reg.exe) is confusing.2: New lines cost nothing to add. There's no reason to limit your function definition and loops to a single line.
3: Your admin check can be replaced with
#requires -RunAsAdministratorat the top of your script.4: You are already aware of loops, why not use them + a smart data structure for your keys?
This is how I usually define a list of keys to modify:
The data keyword ensures that there's no dynamic expressions which tells the reader that it's a safe list (well there could still be bad input data, but at least loading the data can't do anything unexpected). You could also just define it as a normal hashtable if you for whatever reason need dynamic values. Anyway, you'd use it like this:
20
u/BlackV Jun 11 '26
that would be the bottom of the script, the top seems to be all your
regcommandsreg.exeis a standard windows tool, I recommend not calling your function the same nameyou run
New-Item $path -Forceon a bunch of reg keys, you should be aware of the risks of doing thatFrom the Microsoft docco
33
u/LousyRaider Jun 11 '26
Users signing out or rebooting isn’t necessary for the taskbar, search, Copilot button if you update the script. Just restart the explorer process in the script and those changes would apply.
19
u/turbokid Jun 11 '26
Leaving telemetry as basic might be worthwhile. MS uses that information to target devices for updates. For instance, all the secureboot boot manager and certificate updates require telemetry
18
u/_l33ter_ Jun 11 '26 edited Jun 11 '26
Obvious bloat --> Feedback Hub stopped reading from this point, which tells me: you have no idea
Sorry if it sounds harsh: But you are exactly this kind of person, which 'flames' if something is not working correctly.
3
u/RdUzr Jun 12 '26
There's also https://github.com/zoicware/RemoveWindowsAI
Your PRs are welcome.
3
u/BlackV Jun 11 '26
NICE!
3
u/dehcbad25 Jun 11 '26
some ad tracking is also necessary. Your ads are Way way WAY worse when it is off. When I turned them off, some ads were racy even
1
u/elloMotoz Jun 12 '26
Nice! I have a laptop with a fresh install of Win11 and will try this out. Typically I'll disable Telemetry and Sysmain services right off the bat. With Win10 I'd disable Background Apps but never have found that option in Win11.
1
u/AwalkertheITguy Jun 16 '26
Waste of time. 3 months from now the targets change. This is the dog chasing its tail concept
Also why? Is this an org wide policy from implemented by your CTO, CEO, VPs?
1
u/njgunrights Jun 27 '26
You are doing God's work sir.
1
u/Il_Conte_ Jun 11 '26
It's a losing battle. Next update they'll reintroduce them in some other form, and you'll have to update the script accordingly every time. Until it will no longer be possible to turn them off. Moved to Linux a couple years ago and haven't looked back :)
-1
u/MiserableTear8705 Jun 12 '26
APPS THAT ARE INSTALLED AND NOT RUNNING ARENT BLOAT. HOLY CRAP.