Remove-AppxBloat.psm1

function Remove-AppxBloat{

    $AppsToKeep = @(
    
        "Microsoft.AAD.BrokerPlugin",
        "Microsoft.Windows.CloudExperienceHost",
        "Windows.immersivecontrolpanel",
        "Microsoft.Windows.Cortana",
        "Microsoft.MicrosoftEdge",
        "Microsoft.Windows.ContentDeliveryManager",
        "Microsoft.LockApp",
        "Microsoft.Windows.PinningConfirMationDialog",
        "Microsoft.Windows.SecHealthUI",
        "Microsoft.Windows.SecureAssessmentBrowser",
        "Windows.PrintDialog",
        "Windows.CBSPreview",
        "Microsoft.XboxGameCallableUI",
        "Microsoft.Win32WebViewHost",
        "Microsoft.Windows.AssignedAccessLockApp",
        "Microsoft.MicrosoftEdgeDevToolsClient",
        "Microsoft.ECApp",
        "Microsoft.Windows.OOBENetworkConnectionFlow",
        "Microsoft.Windows.Apprep.ChxApp",
        "Microsoft.Windows.OOBENetworkCaptivePortal",
        "Microsoft.Windows.PeopleExperienceHost",
        "Microsoft.Windows.ParentalControls",
        "InputApp",
        "Microsoft.AccountsControl",
        "Microsoft.AsyncTextService",
        "Microsoft.Windows.CapturePicker",
        "Microsoft.CredDialogHost",
        "Microsoft.BioEnrollMent",
        "Microsoft.Windows.ShellExperienceHost",
        "Microsoft.DesktopAppInstaller",
        "Microsoft.WebMediaExtensions",
        "Microsoft.WindowsCamera",
        "Microsoft.Windows.Photos",
        "Microsoft.MicrosoftStickyNotes",
        "Microsoft.MSPaint",
        "Microsoft.UI.XaMl.2.0",
        "Microsoft.WindowsCalculator",
        "Microsoft.WindowsSoundRecorder",
        "Microsoft.ScreenSketch"
    
    )

    Get-AppxPackage | Where-Object {
        $_.Name -NotIn $AppsToKeep -AND
        $_.Name -NotLike "*.NET*" -AND
        $_.Name -NotLike "*Store*" -AND
        $_.Name -NotLike "*VCLibs*"
    } | Remove-AppxPackage -ErrorAction SilentlyContinue


    Get-AppxProvisionedPackage -Online | Where-Object {
        $_.PackageName -NotLike "*AppInstaller*" -AND
        $_.PackageName -NotLike "*StickyNotes*" -AND
        $_.PackageName -NotLike "*Paint*" -AND
        $_.PackageName -NotLike "*Store*" -AND
        $_.PackageName -NotLike "*Photos*" -AND
        $_.PackageName -NotLike "*Calculator*" -AND
        $_.PackageName -NotLike "*Camera*" -AND
        $_.PackageName -NotLike "*Sketch*"

    } | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
}