From 109be998e1b100a7d9aca2d7cc93da9052abe359 Mon Sep 17 00:00:00 2001 From: Yorick Date: Wed, 27 Jan 2016 16:44:12 +0100 Subject: [PATCH] Reworked GWX process detection --- remove-kb.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/remove-kb.ps1 b/remove-kb.ps1 index 99b74b0..26ce96d 100755 --- a/remove-kb.ps1 +++ b/remove-kb.ps1 @@ -79,9 +79,15 @@ function hide_update() { if (!$found){ Write-Host -ForegroundColor Red "Not found"} } } -if (stop-process -name GWX -Force -ErrorAction SilentlyContinue) { - Write-Host "GWX process stopped ..." + +Write-Host -Nonewline -ForegroundColor white "Searching gor GWX process ... " +if (Get-Process -name GWX -ErrorAction SilentlyContinue}) { + Write-Host -ForegroundColor DarkGreen -NoNewLine "Running " + Write-Host -Nonewline -ForegroundColor white "removing ... " + Try {Stop-Process -name GWX -Force -ErrorAction SilentlyContinue} + Catch { Write-Host -ForegroundColor Red "Error"} } +else { Write-Host -ForegroundColor Yellow ("Not running")} Foreach($kbID in $kbIDs){ $kbNum = $kbID.Replace("KB","")