Reworked delete part
This commit is contained in:
parent
06f08a1c1b
commit
2a1afae918
1 changed files with 5 additions and 3 deletions
|
@ -100,9 +100,11 @@ if (Get-Process -name GWX -ErrorAction SilentlyContinue}) {
|
||||||
else { Write-Host -ForegroundColor Yellow ("Not running")}
|
else { Write-Host -ForegroundColor Yellow ("Not running")}
|
||||||
|
|
||||||
#Remove GWX Files (test)
|
#Remove GWX Files (test)
|
||||||
takeown /F "$env:WINDIR\System32\GWX" /R /D $yes
|
takeown /F "$env:WINDIR\System32\GWX" /R /D $yes 2>&1 | Out-Null
|
||||||
icacls "$env:WINDIR\System32\GWX" /C /grant $adminGroup":F" /T
|
icacls "$env:WINDIR\System32\GWX" /C /grant $adminGroup":F" /T 2>&1 | Out-Null
|
||||||
Remove-Item $env:WINDIR\System32\GWX\*
|
Try{ Remove-Item $env:WINDIR\System32\GWX\* -Force -Recurse -ErrorAction SilentlyContinue}
|
||||||
|
Catch {Write-Host -ForegroundColor Red "Some files can't be deleted."}
|
||||||
|
|
||||||
|
|
||||||
Foreach($kbID in $kbIDs){
|
Foreach($kbID in $kbIDs){
|
||||||
$kbNum = $kbID.Replace("KB","")
|
$kbNum = $kbID.Replace("KB","")
|
||||||
|
|
Reference in a new issue