Better unloading
This commit is contained in:
@@ -86,7 +86,13 @@ function SetupEleveReg {
|
|||||||
}
|
}
|
||||||
Write-Host "Added registry entries"
|
Write-Host "Added registry entries"
|
||||||
Write-Host "Unloading registry HIVE"
|
Write-Host "Unloading registry HIVE"
|
||||||
Start-Process cmd -ArgumentList "/c REG UNLOAD HKEY_USERS\$UserSID" -Verb RunAs
|
$res = REG UNLOAD HKEY_USERS\$UserSID
|
||||||
|
if ($res -ne 0) {
|
||||||
|
Write-Host "Failed to unload $username's HKU registry hive."
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Unloaded $username's HKU registry hive."
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host "Unable to get the user's HKU registry."
|
Write-Host "Unable to get the user's HKU registry."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user