Raphire / Win11Debloat

A simple, easy to use PowerShell script to remove pre-installed apps from Windows, disable telemetry, remove Bing from Windows search as well as perform various other changes to declutter and improve your Windows experience. This script works for both Windows 10 and Windows 11.
MIT License
12.88k stars 546 forks source link

Disable-Interactivity failing on Win11 23H2 #51

Closed JMacIV closed 5 months ago

JMacIV commented 5 months ago

https://github.com/Raphire/Win11Debloat/blob/35fc5738f945ef67756003fe8ddea7964a3f039e/Win11Debloat.ps1#L338

Hey, script is great so far! Found a single bug though.

It seems --disable-interactivity is not available for winget on OneDrive.

Argument name was not recognized for the current command : '--disable-interactivity'

This is Win11 Pro 23H2. OneDrive is still installed :(

Edited to add that I running with params "-Silent -RemoveApps"

Attaching screenshot of running this command manually. 2024-04-30_02-13-43

Raphire commented 5 months ago

Heya,

Sorry you're running into this issue. From the provided output it seems like you may be running an old winget version that apparently doesn't have this --disable-interactivity option.

~~Could you check your winget version for me? This can be checked by running the command: winget -v I have version 1.7.10861 installed for reference.~~

Double checking you're image it's showing you're running winget 1.2.10691, this is quite an old version. Could you try updating winget? I believe this is done through the ms store.

JMacIV commented 5 months ago

Hey Raphire - You are correct, I am running v1.2.10691. This is the default version that comes in 23H2 ISO.

From this page on Microsoft, if you click on the versions, it seems they added this "--disable-interactivity" flag with 1.4.

I am fairly certain this PS command will silently install the version from the store... But you might also need to run winget update with that ID afterwards. I could not fully test as this Win11 machine doesn't have a MS store account, but this command got through agreement prompts until interrupted for MS store account. winget install -e -h --id=9nblggh4nns1 --source=msstore --accept-package-agreements

This id value came from this link to the package on MS Store - https://apps.microsoft.com/detail/9nblggh4nns1?rtc=1&hl=en-us&gl=US

Maybe before starting this part of the script, you could add something like $version = (winget -v) -replace 'v', '' if ($version -lt 1.4) { Write-Host "Need to update winget to version 1.4 or later" winget install -e -h --id=9nblggh4nns1 --source=msstore --accept-package-agreements $version = (winget -v) -replace 'v', '' if ($version -lt 1.4) { winget upgrade -e -h --id=9nblggh4nns1 } }

However, if you are okay with downloading these straight from the GitHub repos.... $version = (winget -v) -replace 'v', '' if ($version -lt 1.4) { Write-Host "Need to update winget to version 1.4 or later. Installing Prerequisite and winget straight from GitHub" Add-AppxPackage https://github.com/microsoft/microsoft-ui-xaml/releases/download/v2.8.6/Microsoft.UI.Xaml.2.8.x64.appx Add-AppxPackage https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle }

I can confirm that the GitHub download version worked and my install to v1.7.11132, and I was immediately able to run the original winget uninstall for OneDrive with the --disable-interactivity flag :)

Raphire commented 5 months ago

@JMacIV

Thanks for the detailed response and suggestions. I'll look into this later this weekend!

Raphire commented 5 months ago

Closing issue as resolves, see #52

@JMacIV Thanks for your contribution :)