Removing Bloatware from Windows 10 & 11 via script

One complaint I often hear about using straight OOBE autopilot is around the bloatware, either manufacturer installed (McAfee trials anyone?) or the Microsoft stuff, after all, who needs Xbox Gaming bar on an enterprise machine?

One option is to take the machine and drop on a fresh ISO, add the autopilot hash (or inject the JSON) and then remove the Microsoft apps via Store for Business and uninstall assignments. This of course works well, but it’s effort and also means you can’t ship straight from the manufacturer unless you also send a USB stick with something like the excellent OSD Cloud from David Segura (which I would strongly recommend for “it’s dead, Jim,” rebuilds.

I, personally, prefer to embrace the future and go all out Autopilot, ship straight to your users and let Intune sort the rest which obviously pushes me down the scripting route. There are plenty of scripts out there, but none quite ticked all of the boxes, I wanted something that would remove all MS apps without me having to mess with the store, manufacturer bloat and anything else which might have crept on.

I then saw this post from Ben Whitmore and decided I wanted it to be self-updating too.

So, here is my BloatWare removal script:

https://github.com/andrew-s-taylor/public/tree/main/De-Bloat

In this folder you will find the script to remove the bloat, the script to deploy it and also a script if you want to deploy as an application (as well as the IntuneWin file)

De-Bloat Script

Let’s start with the script itself, it will:

  • Remove AppX Packages (listed)
  • Remove associated reg keys
  • Disable Windows Feedback
  • Removes Cortana from Search
  • Removes Web Results from search
  • Disables Wi-Fi Sense
  • Disables Live Tiles
  • Removes unwanted scheduled tasks (Xbox Live etc.)
  • Removes Windows 11 specific apps (Teams Chat for example)
  • Clears start menu
  • Disables the hidden surfing game in Edge
  • Removes Dell, HP and Lenovo specific bloat (by detecting manufacturer and deploying appropriately)
  • Removes McAfee (if detected)
  • Removes any Win32 apps which aren’t Intune, Windows Update or MS Edge
  • Removes Chrome

I know some of you may be looking at the last two options and worrying about the current estate if you deploy site-wide, but I have you covered. The Win32 app removal part will only run if NO apps have been deployed via Intune. If it detects any installations, it will just skip that bit.

The full script will report back to a log file here:

C:\ProgramData\Debloat\Debloat.log

Intune Script Deployment

My suggestion is to deploy as a device script in Intune, that way it will run prior to any apps installing and you will have the full experience. This is where the secondary script comes in. This will grab the latest copy of the de-bloat script, copy it to the machine and run locally. It’s quicker and means you can always be sure devices are running the latest version without constantly replacing scripts:

NOTE: Run in the 64-bit context

$DebloatFolder = "C:\ProgramData\Debloat"
If (Test-Path $DebloatFolder) {
    Write-Output "$DebloatFolder exists. Skipping."
}
Else {
    Write-Output "The folder '$DebloatFolder' doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
    Start-Sleep 1
    New-Item -Path "$DebloatFolder" -ItemType Directory
    Write-Output "The folder $DebloatFolder was successfully created."
}

$templateFilePath = "C:\ProgramData\Debloat\removebloat.ps1"

Invoke-WebRequest `
-Uri "https://raw.githubusercontent.com/andrew-s-taylor/public/main/De-Bloat/RemoveBloat.ps1" `
-OutFile $templateFilePath `
-UseBasicParsing `
-Headers @{"Cache-Control"="no-cache"}

invoke-expression -Command $templateFilePath

Intune Application Deployment

If you would prefer to deploy as an application, you can either grab the Intunewin file and use the following commands:

Install:

powershell -executionpolicy bypass -file debloat-intune-script.ps1

Uninstall (obviously not an option, so a dead command)

cmd.exe /c

Detection:

C:\ProgramData\Debloat\Debloat.log

OR

If you want to be extra lazy, run this script:

Deploy-DeBloat-Application.ps1

Which will download the file and setup the application for you

Happy de-bloating!

52 thoughts on “Removing Bloatware from Windows 10 & 11 via script”

  1. Greate post!

    When i use the Deploy-DeBloat-Application.ps1 script i get some error messages that the create New-DetectionRule is not recognized.

    Is this due missing modules you are using, if so which modules do you use ?

    Reply
  2. I am having trouble getting this to work. It has ran on my test PC, looking at the logs it says its removed HP Bloat but its still there, and several other things that I have checked. The surf game is listed above but no mention of this on the log file.
    The HP bloat that is present is HP audio control, hp pc hardware diag, hp power manager, hp privacy settings, hp quickdrop, hp support assistant, hp system information and myhp
    This script would be perfect for our needs if we can get these bits sorted, many thanks.

    Reply
      • That’s sounds like it hasn’t deployed properly. Is the script in the ProgramData\DeBloat folder?
        Did it run in the System context as a device targeted script?

        Feel free to drop me an email if it’s easier

        Reply
        • Hi Andrew, cheers for the reply.
          Yes its in the programdata\debloat folder and the log says its run as system.
          I have looked for your email but cant find it directly, do you mean just the contact link on your about page?

          Reply
        • Hi Andrew,
          Thanks for your reply.
          Yes its running as system and in programdata\debloat
          it looks to have done lots of removal and disabling but not the HP bloat and Surf. I am just going to run it again on fresh autopilot.
          What is your email? i cant see it on the site or do you mean from the about page?
          Many thanks

          Reply
  3. Hi Andrew, thanks for this. I have a question. I want to keep Chrome on the device so I’ve commented out the sections on your script however how do I deploy the two scripts exactly. I’ve added the RemoveBloat script on intune however no luck.

    Reply
    • Hi Jess, you have two options for this. Firstly you could just deploy the removebloat script directly in Intune and target your devices, but keep in mind that you’ll need to keep updating it as and when we find more bits to remove.
      The other option is you fork or host the removebloat script in your own storage (and Azure blob would work fine) and then change the Uri in the debloat-intune-script to wherever you are hosting the bloat script itself.
      Feel free to drop me an email on the contact page if you need any help deploying them

      Reply
  4. Andrew this script is amazing. It’s almost 1:30 am and i should be in bed but i’m too excited. I’m watching this thing uninstall everything. lol.

    You have literally saved me hundreds of hours.

    Reply
  5. Hi Andrew,
    First off, thanks for all the work.

    I downloaded all 3 scripts. Which one do I call when creating the devices script? Deploy or Remove, or debloat?

    Thanks again!
    -Frank

    Reply
    • Hi Frank, the remove script is the one that does the actual removal. The Deploy script is if you want to use my version and have the machines always grab the latest copy. It’s entirely up to you which to use between the two.

      Hope this helps

      Reply
  6. It must be a name change because it is unistalling Windows Notepad. My work around is to have inTune reinstall notepad from the appstore after your script has run by using it as a dependency. Anyway….amazing script. THX for sharing.

    Reply
  7. Hi Andrew,

    First and foremost, thank you for your efforts – the script works perfectly except for removing Dell Bloatware – none of the Dell crap was removed, – I tested this on a Windows 11 machine.

    Reply
    • Hi, I have just released a new version which I think should fix the issue. I don’t have a Dell device to hand for testing so the names might need adjusting slightly of the apps. I’ll see if I can find a Dell ISO somewhere to spin up a VM

      Reply
  8. Hi Andy,

    This does not seem to remove the following Dell junk bloatware

    1)Dell Optimzer service
    2) Dell update – support assist update plugin

    Also nothing being removed on HP.
    Could you please release an update

    many thanks.

    Sithum

    Reply
  9. Hi,

    The script also removes firmware update and Waves.
    Attempting to remove Appx package: [WavesAudio.MaxxAudioProforDell2019]…
    Successfully removed Appx package: [WavesAudio.MaxxAudioProforDell2019]
    Attempting to remove Appx package: [WavesAudio.MaxxAudioProforDell2019]…
    Successfully removed Appx package: [WavesAudio.MaxxAudioProforDell2019]
    Attempting to uninstall: [Dell – Extension – 1.8.2.176]…
    Successfully uninstalled: [Dell – Extension – 1.8.2.176]
    Attempting to uninstall: [Dell, Inc. – Firmware – 0.1.7.0]…
    Successfully uninstalled: [Dell, Inc. – Firmware – 0.1.7.0]

    Can you exclude this please?

    Reply
  10. Hello Andrew,
    I ran your script locally on my windows 11 22h2 test machine and it succeeded without any error – well it seemed like. Before running, I did alter some small bits of the script, like commenting and uncommenting things we need/don’t need.

    The start menu didn’t change at all, the bloatware is still there like the spotify link, your phone, office …

    So I took a look in the log file, and it first looked okay, but I was wondering what these logs mean?

    “Trying to remove *app XYZ*
    Path :
    Online : True”

    Regards
    Felix

    Reply
    • Hi Felix,
      On Windows 11, those aren’t actual apps, they are just stubs which install the apps when clicked on.

      The script replaces the start menu on a Windows 10 machine, but Windows 11 works differently so I haven’t added that yet.

      If you are mananging the devices using Intune, the best option is to set the start menu with a config policy

      Reply
  11. Hi Andrew,
    wow – thank you for the quick response. I am right in my assumption that these app removals are applied system-wide and are not user specific? Do you know how windows behaves after bigger updates? Are these apps coming back at some point?

    I’ve tried the updated script, and it works much better now for Windows 11! Looks like Windows Enterprise, love it.

    But there are a few things which are still there:
    – Xbox Game Bar
    – Cortana
    – Microsoft To Do
    – OneDrive

    Would be awesome if you could update your script to delete these too. Maybe even make the “first steps” app as an option for removal?

    Fyi: I want to apply the script within my MDT task sequence. Currently trying to figure out the perfect timing since our domain policy and antivirus program blocks these kinds of scripts, so I have to run it after the installation and before domain join.

    Felix

    Reply
    • Hi Felix,

      The Game Bar is tricky to remove, but I’ve just added an update which will hide the gaming Settings menu.
      Cortana should now be removed as well.

      For To-Do, add this to the blacklisted apps at the top: “Microsoft.Todos”

      OneDrive you would have to look through the registry and call the uninstaller, it’s not something I will be adding to the script though as I feel it’s something everyone should be using anyway.

      The apps shouldn’t return after an update as the appxpackages are removed, but nothing is guaranteed on that front

      Thanks

      Andrew

      Reply
  12. Hello Andrew,
    thanks for the update, hope you had a good start into the new year.

    I finally put the update on my testing machine. The “Microsoft.Todos” wildcard worked and the Game Bar as well as Cortana are now gone, unfortunately WhatsApp, TikTok, Prime Video, Instagram, Adobe Express and Messenger are still there. I tried to alter the script and added these apps with wildcards to the bloatware list like “*Whatsapp*” etc., but it didn’t work. I think it’s because these icons are just links for installing and not the real apps.

    Best regards
    Felix

    Reply
    • Hi Felix,
      When are you running the script? Those aren’t apps but are just install stubs. If you run the script pre-login, it sets the default start menu for new users.
      If you run it after a user has already logged in though, it won’t update for that user.

      Thanks

      Andrew

      Reply
  13. Would it be possible to include a way to add our own whitelisted apps in a local file or something? That way we can leave the automatic download of your script running and we would only have to change the local file.

    Reply
  14. Hey Andrew, thanks for the great work you’re providing. Could you add Microsoft Family to your script? It is now installed with Windows 11 Pro. Thanks, Mike

    Reply
  15. Hi Andrew,

    Many thanks for this great script, it’s ideal for use when autopiloting devices. I have noticed in the log that Dell – Extension and Dell, Inc. – Firmware is being removed even though they’re whitelisted. Log extract below:

    Attempting to uninstall: [Dell – Extension – 1.8.2.176]…
    Successfully uninstalled: [Dell – Extension – 1.8.2.176]
    Attempting to uninstall: [Dell – Extension – 1.8.2.146]…
    Successfully uninstalled: [Dell – Extension – 1.8.2.146]
    Attempting to uninstall: [Dell, Inc. – Firmware – 0.1.8.3]…
    Successfully uninstalled: [Dell, Inc. – Firmware – 0.1.8.3]
    Attempting to uninstall: [Dell, Inc. – Firmware – 11.20.1.7]…
    Successfully uninstalled: [Dell, Inc. – Firmware – 11.20.1.7]

    We’ve amended only a small section of your script and have wrapped it up as a Win32 app.

    Any ideas why this would be happening?

    Many thanks once again.

    Reply
  16. Sorry Andrew, also seems to be uninstalling Edge and other apps after the Detect McAfee script line:

    Uninstalling Microsoft Edge
    Uninstalling Teams Machine-Wide Installer
    Uninstalling Microsoft Intune Management Extension

    Reply
  17. Thanks for coming back so quickly Andrew. Sure, it’s after the Detecting Manufacturer then Dell detected section.

    Reply

Leave a Comment