[system.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
[system.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic') | Out-Null
$computer = [Microsoft.VisualBasic.Interaction]::InputBox("Uninstall KB3170455.", "Uninstall KB3170455", "Computername")
function Uninstall-Hotfix {
[cmdletbinding()]
param(
$computername = $env:computername,
[string] $HotfixID
)
$hotfixes = Get-WmiObject -ComputerName $computername -Class Win32_QuickFixEngineering | select hotfixid
if($hotfixes -match $hotfixID) {
$hotfixID = $HotfixID.Replace("KB","")
Write-host "Located KB3170455 on" $computer
Write-Host "Uninstalling..."
$UninstallString = "cmd.exe /c wusa.exe /uninstall /KB:$hotfixID /quiet /norestart"
([WMICLASS]"\\$computername\ROOT\CIMV2:win32_process").Create($UninstallString) | out-null
while (@(Get-Process wusa -computername $computername -ErrorAction SilentlyContinue).Count -ne 0) {
Start-Sleep 3
Write-Host "Waiting ..."
}
[system.Windows.Forms.Messagebox]::Show("KB3170455 now removed $computer")
}
else {
[system.Windows.Forms.Messagebox]::Show("KB3170455 cant be found on $computer")
return
}
}
Uninstall-HotFix -ComputerName $computer -HotfixID KB3170455 -ErrorAction SilentlyContinue