From 4e312968731068f1bfdb6cbbc01c0b31faf8730e Mon Sep 17 00:00:00 2001 From: Yorick Date: Wed, 16 Mar 2016 14:37:02 +0100 Subject: [PATCH] Lock GWX folder to prevent GWX reinstallation --- remove-kb.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/remove-kb.ps1 b/remove-kb.ps1 index ac90d9f..c82368a 100755 --- a/remove-kb.ps1 +++ b/remove-kb.ps1 @@ -99,6 +99,8 @@ function lock_dir { icacls "$dir" /C /grant $adminGroup":F" /T 2>&1 | Out-Null Try{ Remove-Item $dir\* -Force -Recurse -ErrorAction SilentlyContinue} Catch {Write-Host -ForegroundColor Red "Some files can't be deleted."} + #lock GWX directory + icacls "$dir" /deny *S-1-1-0:`(CI`)`(OI`)F } Write-Host -Nonewline -ForegroundColor white "Searching for GWX process ... "