# WindowsApp-CleanDowngrade.ps1 # Downgrade Windows App to 2.0.964.0 # Clears cached authentication, WebView2 runtime data, and reinstalls Windows App $OutputEncoding = [System.Text.Encoding]::UTF8 $Url = "https://res.cdn.office.net/remote-desktop-windows-client/870e08dc-f2e8-47cb-93ee-d0d3743a8bb6/WindowsApp_x64_Release_2.0.964.0.msix" $Folder = "C:\Temp\WinApp964" $Msix = "$Folder\WindowsApp_2.0.964.0.msix" New-Item -ItemType Directory -Force -Path $Folder | Out-Null Write-Host "" Write-Host "===================================================" Write-Host " Windows App Cleanup and Downgrade" Write-Host "===================================================" Write-Host "" # -------------------------------------------------- # Stop running processes # -------------------------------------------------- Write-Host "Stopping Windows App processes..." Get-Process ` msrdc, ` WindowsApp, ` RemoteDesktop, ` msedgewebview2 ` -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue Start-Sleep 3 # -------------------------------------------------- # Remove Windows App packages # -------------------------------------------------- Write-Host "Removing Windows App packages..." Get-AppxPackage | Where-Object { $_.Name -match "Windows365|WindowsApp" } | ForEach-Object { Write-Host "Removing $($_.Name) $($_.Version)" try { Remove-AppxPackage ` -Package $_.PackageFullName ` -ErrorAction Stop } catch { Write-Warning $_.Exception.Message } } # -------------------------------------------------- # Remove local caches # -------------------------------------------------- Write-Host "Removing local cache..." $CleanupFolders = @( "$env:LOCALAPPDATA\Packages\MicrosoftCorporationII.Windows365_8wekyb3d8bbwe", "$env:LOCALAPPDATA\Packages\MicrosoftCorporationII.WindowsApp_8wekyb3d8bbwe", "$env:LOCALAPPDATA\Microsoft\IdentityCache", "$env:LOCALAPPDATA\Microsoft\TokenBroker", "$env:LOCALAPPDATA\Microsoft\EdgeWebView", "$env:LOCALAPPDATA\Microsoft\OneAuth" ) foreach ($Path in $CleanupFolders) { if (Test-Path $Path) { Write-Host "Removing $Path" Remove-Item ` $Path ` -Recurse ` -Force ` -ErrorAction SilentlyContinue } } # -------------------------------------------------- # DNS Cleanup # -------------------------------------------------- Write-Host "Flushing DNS cache..." ipconfig /flushdns | Out-Null # -------------------------------------------------- # Download package # -------------------------------------------------- Write-Host "Downloading Windows App 2.0.964.0..." if (Test-Path $Msix) { Remove-Item $Msix -Force -ErrorAction SilentlyContinue } Start-BitsTransfer ` -Source $Url ` -Destination $Msix # -------------------------------------------------- # Install package # -------------------------------------------------- Write-Host "Installing Windows App..." Add-AppxPackage ` -Path $Msix ` -ForceApplicationShutdown Start-Sleep 10 # -------------------------------------------------- # Verify installation # -------------------------------------------------- $WindowsApp = Get-AppxPackage | Where-Object { $_.PackageFamilyName -like "*Windows365*" } | Sort-Object Version -Descending | Select-Object -First 1 Write-Host "" Write-Host "===================================================" if ($WindowsApp) { Write-Host "Installation Complete" -ForegroundColor Green Write-Host "Version Installed: $($WindowsApp.Version)" } else { Write-Host "Installation Failed" -ForegroundColor Red } Write-Host "===================================================" Write-Host ""