try { # Check if Hotfix KB5020687 is Installed $hotfix1 = Get-HotFix -Id KB5020687 if ($hotfix1) { # Uninstall Hotfix KB5020687 Uninstall-WindowsUpdate -KBArticleID KB5020687 -Confirm:$false $hotfix1installed = $true } # Check if Hotfix KB5019959 is Installed $hotfix2 = Get-HotFix -Id KB5019959 if ($hotfix2) { # Uninstall Hotfix KB5019959 Uninstall-WindowsUpdate -KBArticleID KB5019959 -Confirm:$false $hotfix2installed = $true } if ($hotfix1installed -or $hotfix2installed) { # Create a System Restore Point Checkpoint-Computer -Description "Hotfixes Removed" # Display a message Write-Host "Hotfixes removed." [console]::beep() } else { # Display a message Write-Host "Hotfixes not detected. No operation was performed." } } catch { $errorMessage = $_.Exception.Message [System.Windows.Forms.MessageBox]::Show("An error occurred: $errorMessage") }