From acca682d28e590d03b7e90ebe85c1331e260ab8d Mon Sep 17 00:00:00 2001 From: srdusr Date: Sat, 8 Jun 2024 18:35:37 +0200 Subject: Testing --- .config/powershell/bloatware.ps1 | 185 ++++++++++++++++++++------------------- 1 file changed, 97 insertions(+), 88 deletions(-) (limited to '.config/powershell/bloatware.ps1') diff --git a/.config/powershell/bloatware.ps1 b/.config/powershell/bloatware.ps1 index 8b9e2a0..411d05b 100644 --- a/.config/powershell/bloatware.ps1 +++ b/.config/powershell/bloatware.ps1 @@ -20,76 +20,76 @@ $bloatware = @( #"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" -) +#$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 { @@ -240,20 +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 -} - -# Prevents "Suggested Applications" returning -if (Check-RegistryKeyExists -KeyPath "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content") { - Set-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" "DisableWindowsConsumerFeatures" 1 -} +## 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 +#} # Disable Microsoft Edge sidebar $RegistryPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Edge' @@ -305,7 +300,6 @@ 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 @@ -371,10 +365,25 @@ foreach ($item in (Get-ChildItem "$env:WinDir\WinSxS\*onedrive*")) { # As a last step, disable UAC ------------------------ New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force -# Remove OneDrive directory +# Remove OneDrive directory if it exists Write-Host "Removing OneDrive directory" -cd $HOME -rm OneDrive -r -force + +# Change directory to user's home directory +Set-Location $HOME + +# Check if OneDrive directory exists +$OneDrivePath = Join-Path $HOME "OneDrive" +if (Test-Path -Path $OneDrivePath -PathType Container) { + # Remove OneDrive directory recursively and forcefully + Remove-Item -Path $OneDrivePath -Recurse -Force -ErrorAction Continue + if ($?) { + Write-Output "OneDrive directory removed successfully." + } else { + Write-Warning "Failed to remove OneDrive directory." + } +} else { + Write-Output "OneDrive directory not found." +} # Prevents "Suggested Applications" returning if (Check-RegistryKeyExists -KeyPath "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content") { -- cgit v1.2.3