diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-06-08 17:50:01 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-06-08 17:50:01 +0200 |
| commit | 5135542f262f68f160be7d0e5b876778c571b113 (patch) | |
| tree | a55b61a77fa90bf319777c83078d93b61c4ca38f /.config/powershell/bloatware.ps1 | |
| parent | b1f74e6c6b678b46b99902fe37e991897721c0c3 (diff) | |
| download | dotfiles-5135542f262f68f160be7d0e5b876778c571b113.tar.gz dotfiles-5135542f262f68f160be7d0e5b876778c571b113.zip | |
Testing
Diffstat (limited to '.config/powershell/bloatware.ps1')
| -rw-r--r-- | .config/powershell/bloatware.ps1 | 142 |
1 files changed, 111 insertions, 31 deletions
diff --git a/.config/powershell/bloatware.ps1 b/.config/powershell/bloatware.ps1 index 6b899c2..8b9e2a0 100644 --- a/.config/powershell/bloatware.ps1 +++ b/.config/powershell/bloatware.ps1 @@ -1,5 +1,96 @@ # bloatware.ps1 +$bloatware = @( + #"Anytime" + "BioEnrollment" + #"Browser" + "ContactSupport" + "Cortana" + #"Defender" + "Feedback" + "Flash" + #"Gaming" # Breaks Xbox Live Account Login + #"Holo" + #"InternetExplorer" + "Maps" + #"MiracastView" + "OneDrive" + #"SecHealthUI" + "Wallet" + #"Xbox" # Causes a bootloop since upgrade 1511? +) + +$apps = @( + # default Windows 10 apps + #"Microsoft.3DBuilder" + "Microsoft.Appconnector" + "Microsoft.BingFinance" + "Microsoft.BingNews" + "Microsoft.BingSports" + "Microsoft.BingTranslator" + "Microsoft.BingWeather" + #"Microsoft.FreshPaint" + #"Microsoft.Microsoft3DViewer" + "Microsoft.MicrosoftOfficeHub" + "Microsoft.MicrosoftSolitaireCollection" + "Microsoft.MicrosoftPowerBIForWindows" + "Microsoft.MinecraftUWP" + #"Microsoft.MicrosoftStickyNotes" + #"Microsoft.NetworkSpeedTest" + "Microsoft.Office.OneNote" + #"Microsoft.OneConnect" + "Microsoft.People" + #"Microsoft.Print3D" + "Microsoft.SkypeApp" + "Microsoft.Wallet" + #"Microsoft.Windows.Photos" + #"Microsoft.WindowsAlarms" + #"Microsoft.WindowsCalculator" + "Microsoft.WindowsCamera" + "microsoft.windowscommunicationsapps" + "Microsoft.WindowsMaps" + "Microsoft.WindowsPhone" + "Microsoft.WindowsSoundRecorder" + "Microsoft.WindowsStore" + #"Microsoft.XboxApp" + #"Microsoft.XboxGameOverlay" + #"Microsoft.XboxIdentityProvider" + #"Microsoft.XboxSpeechToTextOverlay" + "Microsoft.ZuneMusic" + "Microsoft.ZuneVideo" + + # Threshold 2 apps + "Microsoft.CommsPhone" + "Microsoft.ConnectivityStore" + "Microsoft.GetHelp" + "Microsoft.Getstarted" + "Microsoft.Messaging" + "Microsoft.Office.Sway" + "Microsoft.OneConnect" + "Microsoft.WindowsFeedbackHub" + + #Redstone apps + "Microsoft.BingFoodAndDrink" + "Microsoft.BingTravel" + "Microsoft.BingHealthAndFitness" + "Microsoft.WindowsReadingList" + + # non-Microsoft + "king.com.CandyCrushSaga" + "king.com.CandyCrushSodaSaga" + "king.com.*" + "Facebook.Facebook" + + # apps which cannot be removed using Remove-AppxPackage + #"Microsoft.BioEnrollment" + #"Microsoft.MicrosoftEdge" + #"Microsoft.Windows.Cortana" + #"Microsoft.WindowsFeedback" + #"Microsoft.XboxGameCallableUI" + #"Microsoft.XboxIdentityProvider" + #"Windows.ContactSupport" +) + # Check if Registry key exists function Check-RegistryKeyExists { param( @@ -132,26 +223,6 @@ function Elevate-Privileges { $type[0]::EnablePrivilege($processHandle, $Privilege) } -$bloatware = @( - #"Anytime" - "BioEnrollment" - #"Browser" - "ContactSupport" - "Cortana" - #"Defender" - "Feedback" - "Flash" - #"Gaming" # Breaks Xbox Live Account Login - #"Holo" - #"InternetExplorer" - "Maps" - #"MiracastView" - "OneDrive" - #"SecHealthUI" - "Wallet" - #"Xbox" # Causes a bootloop since upgrade 1511? -) - # Remove Features ------------------------ foreach ($bloat in $bloatware) { Write-Output "Removing packages containing $bloat" @@ -169,15 +240,15 @@ foreach ($bloat in $bloatware) { } } -## Remove default apps and bloat ------------------------ -#Write-Output "Uninstalling default apps" -#foreach ($app in $apps) { -# Write-Output "Trying to remove $app" -# Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers -# Get-AppXProvisionedPackage -Online | -# Where-Object DisplayName -EQ $app | -# Remove-AppxProvisionedPackage -Online -#} +# Remove default apps and bloat ------------------------ +Write-Output "Uninstalling default apps" +foreach ($app in $apps) { + Write-Output "Trying to remove $app" + Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers + Get-AppXProvisionedPackage -Online | + Where-Object DisplayName -EQ $app | + Remove-AppxProvisionedPackage -Online +} # Prevents "Suggested Applications" returning if (Check-RegistryKeyExists -KeyPath "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content") { @@ -234,7 +305,7 @@ Write-Output "Edge should now be uninstalled!" Write-Output "Kill OneDrive process" taskkill.exe /F /IM "OneDrive.exe" taskkill.exe /F /IM "explorer.exe" - +Stop-Process -Name OneDrive -Force Write-Output "Remove OneDrive" if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") { & "$env:systemroot\System32\OneDriveSetup.exe" /uninstall @@ -285,7 +356,16 @@ Start-Sleep 10 Write-Output "Removing additional OneDrive leftovers" foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*")) { Takeown-Folder $item.FullName - Remove-Item -Recurse -Force $item.FullName + try { + Remove-Item -Recurse -Force -ErrorAction Continue -ErrorVariable RemoveError $item.FullName + if ($RemoveError) { + Write-Warning "Failed to remove $($item.FullName): $($RemoveError.Exception.Message)" + } else { + Write-Output "Successfully removed: $($item.FullName)" + } + } catch { + Write-Warning "Failed to remove $($item.FullName): $_" + } } # As a last step, disable UAC ------------------------ |
