Lock GWX folder to prevent GWX reinstallation

This commit is contained in:
Yorick Barbanneau 2016-03-16 14:37:02 +01:00
parent eecf96cf8b
commit 4e31296873

View file

@ -99,6 +99,8 @@ function lock_dir {
icacls "$dir" /C /grant $adminGroup":F" /T 2>&1 | Out-Null icacls "$dir" /C /grant $adminGroup":F" /T 2>&1 | Out-Null
Try{ Remove-Item $dir\* -Force -Recurse -ErrorAction SilentlyContinue} Try{ Remove-Item $dir\* -Force -Recurse -ErrorAction SilentlyContinue}
Catch {Write-Host -ForegroundColor Red "Some files can't be deleted."} 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 ... " Write-Host -Nonewline -ForegroundColor white "Searching for GWX process ... "