categories/Appx.ps1
|
# Appx Bloatware category: Xbox, Bing News/Weather, Solitaire, and similar preinstalled apps. # Package removal is irreversible within Octa (see IrreversibleReason below) - the System # Restore Point (Constitution Principle I) is the rollback path for this category. $script:OctaAppxBloatPatterns = @( 'Microsoft.XboxApp', 'Microsoft.Xbox.TCUI', 'Microsoft.XboxGamingOverlay', 'Microsoft.XboxIdentityProvider', 'Microsoft.XboxSpeechToTextOverlay', 'Microsoft.GamingApp', 'Microsoft.BingNews', 'Microsoft.BingWeather', 'Microsoft.MicrosoftSolitaireCollection', 'Microsoft.ZuneMusic', 'Microsoft.ZuneVideo', 'Microsoft.MixedReality.Portal', 'Microsoft.GetHelp', 'Microsoft.Getstarted', 'Microsoft.WindowsFeedbackHub' ) function Get-OctaAppxCategory { [CmdletBinding()] param() return [pscustomobject]@{ Id = 'appx' DisplayName = 'Appx Bloatware' Description = 'Xbox, Bing News/Weather, Solitaire, etc.' RequiresElevation = $true ContainsIrreversibleActions = $true GetActionsFunction = 'Get-OctaAppxActions' ApplyActionFunction = 'Set-OctaAppxAction' } } function Get-OctaAppxActions { [CmdletBinding()] param() $actions = @() foreach ($pattern in $script:OctaAppxBloatPatterns) { $packages = Get-AppxPackage -AllUsers -Name $pattern -ErrorAction SilentlyContinue foreach ($pkg in $packages) { $actions += New-OctaAction -TargetType Package -TargetIdentifier $pkg.PackageFullName ` -CurrentValue 'Installed' -PlannedValue 'Removed' -Reversible $false ` -IrreversibleReason 'Octa cannot reinstall a removed Appx package; reinstall from Microsoft Store or use the System Restore Point.' } } return $actions } function Set-OctaAppxAction { [CmdletBinding()] param([Parameter(Mandatory)]$Action) Remove-AppxPackage -Package $Action.TargetIdentifier -AllUsers -ErrorAction Stop } |