ninja-one/remove-w11-bloatware.ps1

begin {

}
process {
    try {
        $logPath = $env:TEMP
        $logFile = "Win11Debloat.log"
        $logFullPath = Join-Path -Path $logPath -ChildPath $logFile
        Write-Host "[INFO] Starting debloat process (logging to $logFullPath)..."

        if (Test-Path $logFullPath) {
            Remove-Item $logFullPath -ErrorAction SilentlyContinue
        }

        & ([scriptblock]::Create((Invoke-RestMethod "https://debloat.raphi.re/"))) -Silent -NoRestartExplorer -LogPath $logPath -RemoveApps -Apps "Microsoft.3DBuilder,Microsoft.Microsoft3DViewer,ACGMediaPlayer,ActiproSoftwareLLC,AdobeSystemsIncorporated.AdobePhotoshopExpress,Amazon.com.Amazon,Asphalt8Airborne,AutodeskSketchBook,Microsoft.BingFinance,Microsoft.BingFoodAndDrink,Microsoft.BingHealthAndFitness,Microsoft.BingNews,Microsoft.BingSports,Microsoft.BingTranslator,Microsoft.BingTravel,king.com.BubbleWitch3Saga,CaesarsSlotsFreeCasino,king.com.CandyCrushSaga,king.com.CandyCrushSodaSaga,COOKINGFEVER,CyberLinkMediaSuiteEssentials,Microsoft.Windows.DevHome,Disney,DisneyMagicKingdoms,DrawboardPDF,Duolingo-LearnLanguagesforFree,EclipseManager,Facebook,MicrosoftCorporationII.MicrosoftFamily,FarmVille2CountryEscape,Microsoft.WindowsFeedbackHub,fitbit,Flipboard,Microsoft.Getstarted,HiddenCity,HULULLC.HULUPLUS,iHeartRadio,Instagram,LinkedInforWindows,Sidia.LiveWallpaper,MarchofEmpires,Microsoft.News,Microsoft.MixedReality.Portal,Netflix,Microsoft.NetworkSpeedTest,NYTCrossword,OneCalendar,Microsoft.OneConnect,PandoraMediaInc,PhototasticCollage,PicsArt-PhotoStudio,Plex,PolarrPhotoEditorAcademicEdition,AmazonVideo.PrimeVideo,Microsoft.Print3D,MicrosoftCorporationII.QuickAssist,Royal Revolt,Shazam,Microsoft.SkypeApp,SlingTV,Microsoft.MicrosoftSolitaireCollection,Spotify,Microsoft.Office.Sway,TikTok,TuneInRadio,Twitter,Viber,Microsoft.WindowsMaps,Wunderlist,Microsoft.XboxApp,Microsoft.XboxGameOverlay,Microsoft.GamingApp,Microsoft.XboxGamingOverlay,Microsoft.XboxIdentityProvider,XING" -ErrorAction SilentlyContinue   
    
        # check if the file "Win11Debloat.log" exists in the current directory, if it does, output it to the console and then delete it
        if (Test-Path "$logFullPath") {
            Get-Content "$logFullPath" | Write-Host
            Remove-Item "$logFullPath" -ErrorAction SilentlyContinue
        } else {
            Write-Host "[INFO] No log file found, skipping output and deletion."
        }
    }
    catch {
        # output the error and the line it came from
        Write-Host "[ERROR] Error: $_"
        Write-Host "[ERROR] Line: $($_.InvocationInfo.ScriptLineNumber)"
        exit 1
    }
}

end {
    
}