Bug : update always show not installed

This commit is contained in:
Yorick Barbanneau 2016-01-20 14:07:01 +01:00
parent f8a21de7f3
commit 4850f846e7

View file

@ -43,19 +43,19 @@ function hide_update() {
Foreach($kbID in $kbIDs){ Foreach($kbID in $kbIDs){
$kbNum = $kbID.Replace("KB","") $kbNum = $kbID.Replace("KB","")
Write-Host -NoNewline -ForegroundColor white "Uninstalling $kbID : " Write-Host -NoNewline -ForegroundColor white "Uninstalling $kbID : "
if (Get-HotFix -Id $kbID -ErrorAction SilentlyContinue)){
if ($exist){ Write-Host -NoNewline -ForegroundColor DarkGreen "found!"
Write-Host -NoNewline -ForegroundColor DarkGreen "found!" -ForegroundColor white "removing ... " Write-Host -Nonewline -ForegroundColor white "removing ... "
wusa.exe /uninstall /KB:$kbNum /norestart /quiet /log:wsua.log wusa.exe /uninstall /KB:$kbNum /norestart /quiet /log:wsua.log
Do Do
{ {
Start-Sleep -Seconds 3 Start-Sleep -Seconds 3
}while(Invoke-Command -ScriptBlock {Get-Process | Where-Object {$_.name -eq "wusa"}}) }while(Invoke-Command -ScriptBlock {Get-Process | Where-Object {$_.name -eq "wusa"}})
if(Get-HotFix -Id $kbID -ErrorAction SilentlyContinue){ if(Get-HotFix -Id $kbID -ErrorAction SilentlyContinue){
Write-Host -NoNewline -ForegroundColor Red "Failed" Write-Host -NoNewline -ForegroundColor Red "Failed"
} }
else{ else{
Write-Host -NoNewline -ForegroundColor Green "Done" Write-Host -NoNewline -ForegroundColor Green "Done"
} }
} }
else { else {