diff options
| author | seth <[email protected]> | 2024-03-06 17:12:26 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2024-03-06 17:12:26 -0500 |
| commit | a66edb771502d36c67e50977dca20b414e767f55 (patch) | |
| tree | e67ec5e85853cc2a9f1e4008714a5b43c41da8ac | |
| parent | a37c8e6da88389bf5030e1ae4ff601c29b6c2f03 (diff) | |
split up scripts
| -rw-r--r-- | README.md | 9 | ||||
| -rw-r--r-- | debloat.ps1 | 165 | ||||
| -rw-r--r-- | disable_services.ps1 | 39 | ||||
| -rw-r--r-- | install_apps.ps1 | 45 | ||||
| -rw-r--r-- | privacy.ps1 | 163 | ||||
| -rw-r--r-- | remove_preinstalled_apps.ps1 | 46 |
6 files changed, 285 insertions, 182 deletions
@@ -1,3 +1,12 @@ # windows-scripts small collection of scripts i use when (re)installing windows + +## how to run + +after downloading this repo, open powershell as admin and run this command in the directory: `Get-Item *.ps1 | Unblock-File` + +> [!NOTE] +> the `Unrestricted` execution policy should not be permanently set, this is why we're using `-Scope Process` + +if this doesn't allow you to execute the scripts, use `Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process` and try again diff --git a/debloat.ps1 b/debloat.ps1 deleted file mode 100644 index eaf4625..0000000 --- a/debloat.ps1 +++ /dev/null @@ -1,165 +0,0 @@ -<# -.SYNOPSIS - Post-install script for "debloating" Windows -.DESCRIPTION - Removes default apps, disables telemetry, services, and some other annoying things -.NOTES - Inspired by https://gist.github.com/mikepruett3/7ca6518051383ee14f9cf8ae63ba18a7 -#> - -$VerbosePreference = "Continue" - -function Add-Key { - param ( - [String]$Name, - [String]$Path, - [Microsoft.Win32.RegistryValueKind]$Type, - [System.Object]$Value - ) - - Write-Verbose -Message "Adding registry key $Path\$Name" - if (-not(Test-Path -Path $Path)) { - Write-Verbose -Message "Creating registry path $Path" - New-Item -Path $Path -Force - } - New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force -} - -function Remove-DefaultPackage { - param ( - [String]$Name - ) - - Write-Verbose -Message "Removing default package $Name" - Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -Like $Name} | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName} - Write-Verbose -Message "Removing $Name from current user" - Get-AppxPackage $Name | Remove-AppxPackage -} - - -# actual start of the script :p -Write-Host "Starting post-install script!" - - -# --- Privacy/Usability Settings --- -# see https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services - -## Disable Cortana and Web Search -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowCortana" -Type DWord -Value 0 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "AllowSearchToUseLocation" -Type DWord -Value 0 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "DisableWebSearch" -Type DWord -Value 1 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name "ConnectedSearchUseWeb" -Type DWord -Value 0 - -## Disable OneDrive -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name "DisableFileSyncNGSC" -Type DWord -Value 1 -Add-Key -Path "HKLM:\SOFTWARE\Microsoft\OneDrive" -Name "PreventNetworkTrafficPreUserSignIn" -Type DWord -Value 1 - -## Disable Advertising ID -Add-Key -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name "Enabled" -Type DWord -Value 0 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name "DisabledByGroupPolicy" -Type DWord -Value 1 -Add-Key -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackProgs" -Type DWord -Value 0 - -## Disable apps' access to some things -$app_access = @( - "LetAppsAccessLocation" - "LetAppsAccessContacts" - "LetAppsAccessCalendar" - "LetAppsAccessCallHistory" - "LetAppsAccessEmail" - "LetAppsAccessMessaging" - "LetAppsAccessPhone" - "LetAppsAccessRadios" - "LetAppsAccessMotion" - "LetAppsAccessTasks" - "LetAppsGetDiagnosticInfo" - "LetAppsActivateWithVoice" - "LetAppsActivateWithVoiceAboveLock" -) - -foreach ($access in $app_access) { - Add-Key "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" -Name $access -Type DWord -Value 2 -} - -Add-Key "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Messaging" -Name "AllowMessageSync" -Type DWord -Value 0 - -## Disable Feedback & diagnostics -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "DoNotShowFeedbackNotifications" -Type DWord -Value 1 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name "AllowTelemetry" -Type DWord -Value 0 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1 -Add-Key -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableTailoredExperiencesWithDiagnosticData" -Type DWord -Value 1 - -## Disable Inking & Typing data collection -Add-Key -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitTextCollection" -Type DWord -Value 1 -Add-Key -Path "HKCU:\SOFTWARE\Microsoft\InputPersonalization" -Name "RestrictImplicitInkCollection" -Type DWord -Value 1 - -## Disable Activity History -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "EnableActivityFeed" -Type DWord -Value 0 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "PublishUserActivities" -Type DWord -Value 0 -Add-Key -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "UploadUserActivities" -Type DWord -Value 0 - -## Disable Windows Defender sample submission -Add-Key "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" -Name "SubmitSamplesConsent" -Type DWord -Value 2 - -## Disable News and interests -Add-Key "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name "EnableFeeds" -Type DWord -Value 0 - -## Disable Personalized Experiences -Add-Key -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsSpotlightFeatures" -Type DWord -Value 1 -Add-Key -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableCloudOptimizedContent" -Type DWord -Value 1 - -## Disable Copilot -Add-Key "HKCU:\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" -Name "TurnOffWindowsCopilot" -Type DWord -Value 1 - - -# --- Remove Default Packages --- -$packages = @( - "Microsoft.BingNews" - "Microsoft.BingWeather" - "Microsoft.BingFinance" - "Microsoft.BingSports" - "*.Twitter" - # "Microsoft.XboxApp" # this won't break much - # these will: - # "Microsoft.Xbox.TCUI" - # "Microsoft.XboxGameCallableUI" - # "Microsoft.XboxGamingOverlay" - # "Microsoft.XboxIdentityProvider" - "Microsoft.Office.Sway" - "Microsoft.Office.OneNote" - "Microsoft.MicrosoftOfficeHub" - "Microsoft.SkypeApp" - "Microsoft.MicrosoftStickyNotes" -) - -foreach ($pkg in $packages) { - Remove-DefaultPackage -Name $pkg -} - - -# --- Disable Extra Services --- -## sourced from https://github.com/ChrisTitusTech/winutil -$services = @( - "AJRouter" - "Browser" - "BthAvctpSvc" - "diagnosticshub.standardcollector.service" - "DiagTrack" - "Fax" - "fhsvc" - "lmhosts" - "PhoneSvc" - "RemoteAccess" - "RemoteRegistry" - "RetailDemo" - # "wisvc" # Windows Insider, uncomment if you'll never use it - "WMPNetworkSvc" - "WPDBusEnum" -) - -foreach ($service in $services) { - Write-Verbose -Message "Disabling $service" - Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Manual -ErrorAction SilentlyContinue -} - - -Write-Host "Done!" diff --git a/disable_services.ps1 b/disable_services.ps1 new file mode 100644 index 0000000..bbe4a1e --- /dev/null +++ b/disable_services.ps1 @@ -0,0 +1,39 @@ +<# +.SYNOPSIS + Disables automatic startup of unneeded services +.NOTES + Sourced from https://learn.microsoft.com/en-us/windows/iot/iot-enterprise/optimize/services +#> + +$ErrorActionPreference = "Stop" + + +$manualServices = @( + "CDPSvc" + "DiagTrack" + "MapsBroker" + "OneSyncSvc" + "RemoteRegistry" + "RetailDemo" +) + +foreach ($service in $manualServices) { + Write-Host -Message "Disabling $service" + Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Manual -ErrorAction SilentlyContinue +} + +$disabledServices = @( + "XboxGipSvc" + "XblAuthManager" + "XblGameSave" + "XboxNetApiSvc" +) + +# You probably don't want to do this, as it will break any and all xbox games :/ +# foreach ($service in $disabledServices) { +# Write-Host -Message "Disabling $service" +# Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled -ErrorAction SilentlyContinue +# } + + +Write-Host "Done!" diff --git a/install_apps.ps1 b/install_apps.ps1 index e291754..cb9514d 100644 --- a/install_apps.ps1 +++ b/install_apps.ps1 @@ -1,12 +1,14 @@ <# .SYNOPSIS Post-install script for adding all my apps +.NOTES + Inspired by https://gist.github.com/mikepruett3/7ca6518051383ee14f9cf8ae63ba18a7 #> $ErrorActionPreference = "Stop" -function Install-Winget-Package { +function Install-WingetPackage { param ( [String]$Package ) @@ -21,15 +23,12 @@ function Install-Winget-Package { } } -# This script does a lot so a warning is good -if ( (Read-Host -Prompt "Do you want to install all packages? [y/n]?").toLower() -ne "y" ) { - Write-Host "You didn't say yes! Bailing out..." - Exit -} +function Install-Winget { + <# + .NOTES + Sourced from https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901 + #> -# Install winget if it's not already -## https://gist.github.com/crutkas/6c2096eae387e544bd05cde246f23901 -if (! (Get-AppxPackage -Name "Microsoft.DesktopAppInstaller") ) { Write-Host -Message "Installing winget" $releasesUrl = "https://api.github.com/repos/microsoft/winget-cli/releases/latest" @@ -39,16 +38,28 @@ if (! (Get-AppxPackage -Name "Microsoft.DesktopAppInstaller") ) { Write-Verbose -Message "Installing latest release from $($latestRelease.browser_download_url))" Add-AppxPackage -Path $latestRelease.browser_download_url - Write-Host -Message "Done!" + Write-Host -Message "Installed WinGet!" +} + + +# This script does a lot so a warning is good +if ( (Read-Host -Prompt "Do you want to install all packages? [y/n]?").toLower() -ne "y" ) { + Write-Host -Message "You didn't say yes! Bailing out..." + Exit +} + +# Install winget if it's not already +if (! (Get-AppxPackage -Name "Microsoft.DesktopAppInstaller") ) { + Install-Winget } $wingetPackages = @( - # apps - "Cemu.Cemu" + # regular apps + #"Cemu.Cemu" "Hibbiki.Chromium" "Ubisoft.Connect" "Discord.Discord" - "DolphinEmulator.Dolphin" + #"DolphinEmulator.Dolphin" "ElectronicArts.EADesktop" "Element.Element" "EpicGames.EpicGamesLauncher" @@ -58,12 +69,12 @@ $wingetPackages = @( "OBSProject.OBSStudio" "dotPDNLLC.paintdotnet" "PrismLauncher.PrismLauncher" - "Libretro.RetroArch" + #"Libretro.RetroArch" "Spotify.Spotify" "Valve.Steam" "tailscale.tailscale" "OneGal.Viper" - "YuzuEmu.Yuzu.Mainline" + #"YuzuEmu.Yuzu.Mainline" # utils "bootandy.dust" @@ -108,7 +119,7 @@ $wingetPackages = @( ) foreach ($package in $wingetPackages) { - Install-Winget-Package -Package $package + Install-WingetPackage -Package $package } -Write-Host "Done!" +Write-Host -Message "Done!" diff --git a/privacy.ps1 b/privacy.ps1 new file mode 100644 index 0000000..ea0b1fc --- /dev/null +++ b/privacy.ps1 @@ -0,0 +1,163 @@ +<# +.SYNOPSIS + Disables most telemetry for Windows +.NOTES + Sourced from https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services +#> + +$ErrorActionPreference = "Stop" + + +function Add-RegKey { + param ( + [String]$Path, + [String]$Name, + [Microsoft.Win32.RegistryValueKind]$Type, + [System.Object]$Value + ) + + Write-Verbose -Message "Adding registry key $Path\$Name" + if (-not(Test-Path -Path $Path)) { + Write-Verbose -Message "Creating registry path $Path" + New-Item -Path $Path -Force + } + New-ItemProperty -Path $Path -Name $Name -Value $Value -PropertyType $Type -Force +} + +function Disable-Cortana { + Write-Host -Message "Disabling Cortana" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name AllowCortana -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name AllowSearchToUseLocation -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name DisableWebSearch -Value 1 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name ConnectedSearchUseWeb -Value 0 -Type DWord +} + +function Disable-DeviceMetadataRetrieval { + Write-Host -Message "Disabling device metadata retrieval" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata" -Name PreventDeviceMetadataFromNetwork -Value 1 -Type DWord +} + +function Disable-FindMyDevice { + Write-Host -Message "Disabling find my device" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\FindMyDevice" -Name AllowFindMyDevice -Value 0 -Type DWord +} + +function Disable-InsiderBuilds { + Write-Host -Message "Disabling Windows Insider builds" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\PreviewBuilds" -Name AllowBuildPreview -Value 0 -Type DWord +} + +function Disable-MailSynchronization { + Write-Host -Message "Disabling mail synchronization" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows Mail" -Name ManualLaunchAllowed -Value 0 -Type DWord +} + +function Disable-OfflineMaps { + Write-Host -Message "Disabling offline maps" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Maps" -Name AutoDownloadAndUpdateMapData -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Maps" -Name AllowUntriggeredNetworkTrafficOnSettingsPage -Value 0 -Type DWord +} + +function Disable-OneDrive { + Write-Host -Message "Disabling OneDrive" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\OneDrive" -Name DisableFileSyncNGSC -Value 1 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Microsoft\OneDrive" -Name PreventNetworkTrafficPreUserSignIn -Value 1 -Type DWord +} + +function Harden-PrivacySettings { + Write-Host -Message "Hardening privacy settings" + Add-RegKey -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" -Name Enabled -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" -Name DisabledByGroupPolicy -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name Start_TrackProgs -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\LocationAndSensors" -Name DisableLocation -Value 1 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\PushNotifications" -Name NoCloudApplicationNotification -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\Software\Microsoft\Speech_OneCore\Settings\OnlineSpeechPrivacy" -Name HasAccepted -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Speech" -Name AllowSpeechModelUpdate -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\Messaging" -Name AllowMessageSync -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name DoNotShowFeedbackNotifications -Value 1 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\DataCollection" -Name AllowTelemetry -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name DisableWindowsConsumerFeatures -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name DisableTailoredExperiencesWithDiagnosticData -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name RestrictImplicitTextCollection -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\Software\Microsoft\InputPersonalization" -Name RestrictImplicitInkCollection -Value 1 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\System" -Name EnableActivityFeed -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\System" -Name PublishUserActivities -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\System" -Name UploadUserActivities -Value 0 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Feeds" -Name EnableFeeds -Value 0 -Type DWord + + $permissions = @( + "LetAppsAccessLocation" + # You might want these + # "LetAppsAccessCamera" + # "LetAppsAccessMicrophone" + # "LetAppsAccessNotifications" + # "LetAppsAccessAccountInfo" + "LetAppsAccessContacts" + "LetAppsAccessCalendar" + "LetAppsAccessCallHistory" + "LetAppsAccessEmail" + "LetAppsAccessMessaging" + "LetAppsAccessPhone" + "LetAppsAccessRadios" + "LetAppsSyncWithDevices" + "LetAppsAccessTrustedDevices" + # Ditto + # "LetAppsRunInBackground" + "LetAppsAccessMotion" + "LetAppsAccessTasks" + "LetAppsGetDiagnosticInfo" + # Ditto + # "LetAppsActivateWithVoice" + # "LetAppsActivateWithVoiceAboveLock" + ) + + foreach ($permission in $permissions) { + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\AppPrivacy" -Name $permission -Value 2 -Type DWord + } +} + +function Disable-SettingsSync { + Write-Host -Message "Disabling settings sync" + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\SettingSync" -Name DisableSettingSync -Value 2 -Type DWord + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows\SettingSync" -Name DisableSettingSyncUserOverride -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\SOFTWARE\Microsoft\Messaging" -Name CloudServiceSyncEnabled -Value 0 -Type DWord +} + +function Disable-AutomaticSampleSubmission { + Write-Host -Message "Disabling Windows Defender automatic sample submission" + Add-RegKey -Path "HKLM:\Software\Policies\Microsoft\Windows Defender\Spynet" -Name SubmitSamplesConsent -Value 2 -Type DWord +} + +function Disable-PersonalizedExperiences { + Write-Host -Message "Disabling Personalized Experiences" + Add-RegKey -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name DisableWindowsSpotlightFeatures -Value 1 -Type DWord + Add-RegKey -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name DisableCloudOptimizedContent -Value 1 -Type DWord +} + +function Disable-MicrosoftStore { + Write-Host -Message "Disabling Microsoft Store apps" + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" -Name DisableStoreApps -Value 1 -Type DWord + Add-RegKey -Path "HKLM:\SOFTWARE\Policies\Microsoft\WindowsStore" -Name AutoDownload -Value 2 -Type DWord +} + +function Disable-Copilot { + Write-Host -Message "Disabling Copilot" + Add-RegKey -Path "HKCU:\SOFTWARE\Policies\Microsoft\Windows\WindowsCopilot" -Name "TurnOffWindowsCopilot" -Value 1 -Type DWord +} + + +Disable-Cortana +Disable-DeviceMetadataRetrieval +# Disable-FindMyDevice +# Disable-InsiderBuilds +Disable-MailSynchronization +Disable-OfflineMaps +Disable-OneDrive +Harden-PrivacySettings +Disable-SettingsSync +Disable-AutomaticSampleSubmission +Disable-PersonalizedExperiences +# Disable-MicrosoftStore +Disable-Copilot + +Write-Host -Message "Done!" diff --git a/remove_preinstalled_apps.ps1 b/remove_preinstalled_apps.ps1 new file mode 100644 index 0000000..168e32b --- /dev/null +++ b/remove_preinstalled_apps.ps1 @@ -0,0 +1,46 @@ +<# +.SYNOPSIS + Automatically remove preinstalled apps on Windows 10/11 +.NOTES + Sourced from https://learn.microsoft.com/en-us/windows/privacy/manage-connections-from-windows-operating-system-components-to-microsoft-services#bkmk-preinstalledapps +#> + +$ErrorActionPreference = "Stop" + + +function Remove-DefaultPackage { + param ( + [String]$Package + ) + + Write-Host -Message "Removing default package $Package..." + Get-AppxProvisionedPackage -Online | Where-Object {$_.PackageName -Like $Package} | ForEach-Object { Remove-AppxProvisionedPackage -Online -PackageName $_.PackageName} + Write-Host -Message "Removing $Package from current user..." + Get-AppxPackage $Package | Remove-AppxPackage +} + +$packages = @( + "Microsoft.BingNews" + "Microsoft.BingWeather" + "Microsoft.BingFinance" + "Microsoft.BingSports" + "*.Twitter" + # This won't break much + # "Microsoft.XboxApp" + # These will, though + # "Microsoft.Xbox.TCUI" + # "Microsoft.XboxGameCallableUI" + # "Microsoft.XboxGamingOverlay" + # "Microsoft.XboxIdentityProvider" + "Microsoft.Office.Sway" + "Microsoft.Office.OneNote" + "Microsoft.MicrosoftOfficeHub" + "Microsoft.SkypeApp" + "Microsoft.MicrosoftStickyNotes" +) + +foreach ($package in $packages) { + Remove-DefaultPackage -Name $package +} + +Write-Host -Message "Done" |
