mirror of
https://github.com/Raphire/Win11Debloat.git
synced 2025-11-16 18:46:19 +00:00
Add task for removing MS Edge & OneDrive when run as other user or sysprep mode #366
This commit is contained in:
4
Regfiles/Sysprep/Uninstall_Microsoft_Edge.reg
Normal file
4
Regfiles/Sysprep/Uninstall_Microsoft_Edge.reg
Normal file
@@ -0,0 +1,4 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[hkey_users\default\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
|
||||
"UninstallMicrosoftEdge"="cmd.exe /c winget uninstall --accept-source-agreements --disable-interactivity --id Microsoft.Edge"
|
||||
4
Regfiles/Sysprep/Uninstall_Microsoft_OneDrive.reg
Normal file
4
Regfiles/Sysprep/Uninstall_Microsoft_OneDrive.reg
Normal file
@@ -0,0 +1,4 @@
|
||||
Windows Registry Editor Version 5.00
|
||||
|
||||
[hkey_users\default\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
|
||||
"UninstallMicrosoftOneDrive"="cmd.exe /c winget uninstall --accept-source-agreements --disable-interactivity --id Microsoft.OneDrive"
|
||||
@@ -383,8 +383,18 @@ function RemoveApps {
|
||||
Write-Host "Error: WinGet is either not installed or is outdated, $app could not be removed" -ForegroundColor Red
|
||||
}
|
||||
else {
|
||||
# Uninstall app via winget
|
||||
Strip-Progress -ScriptBlock { winget uninstall --accept-source-agreements --disable-interactivity --id $app } | Tee-Object -Variable wingetOutput
|
||||
$appName = $app -replace '\.', '_'
|
||||
|
||||
# Uninstall app via winget, or create a scheduled task to uninstall it later
|
||||
if ($script:Params.ContainsKey("User")) {
|
||||
RegImport "Adding scheduled task to uninstall $app for user $(GetUserName)..." "Uninstall_$($appName).reg"
|
||||
}
|
||||
elseif ($script:Params.ContainsKey("Sysprep")) {
|
||||
RegImport "Adding scheduled task to uninstall $app after new users log in..." "Uninstall_$($appName).reg"
|
||||
}
|
||||
else {
|
||||
Strip-Progress -ScriptBlock { winget uninstall --accept-source-agreements --disable-interactivity --id $app } | Tee-Object -Variable wingetOutput
|
||||
}
|
||||
|
||||
If (($app -eq "Microsoft.Edge") -and (Select-String -InputObject $wingetOutput -Pattern "Uninstall failed with exit code")) {
|
||||
Write-Host "Unable to uninstall Microsoft Edge via Winget" -ForegroundColor Red
|
||||
|
||||
Reference in New Issue
Block a user