Reg test
This commit is contained in:
@@ -10,8 +10,8 @@ function UserReg {
|
|||||||
$UserSID = $UserProfile.SID
|
$UserSID = $UserProfile.SID
|
||||||
if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) {
|
if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) {
|
||||||
Write-Host "REG LOAD HKEY_USERS\$UserSID C:\Users\$Username\NTUSER.DAT"
|
Write-Host "REG LOAD HKEY_USERS\$UserSID C:\Users\$Username\NTUSER.DAT"
|
||||||
$res = REG LOAD HKEY_USERS\$UserSID "C:\Users\$Username\NTUSER.DAT"
|
$res = REG LOAD HKEY_USERS\$UserSID C:\Users\$Username\NTUSER.DAT
|
||||||
if ($res -ne 0) {
|
if ($res -e 1) {
|
||||||
Write-Host "Failed to load $Username's HKU registry hive."
|
Write-Host "Failed to load $Username's HKU registry hive."
|
||||||
return $null, $null
|
return $null, $null
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,10 @@ function SetupEleveReg {
|
|||||||
Write-Host "Added registry entries"
|
Write-Host "Added registry entries"
|
||||||
Write-Host "Unloading registry HIVE"
|
Write-Host "Unloading registry HIVE"
|
||||||
Write-Host "REG UNLOAD HKEY_USERS\$UserSID"
|
Write-Host "REG UNLOAD HKEY_USERS\$UserSID"
|
||||||
Start-Process powershell.exe -ArgumentList "REG UNLOAD HKEY_USERS\$UserSID" -WindowStyle Hidden
|
$res = REG UNLOAD HKEY_USERS\$UserSID
|
||||||
|
if ($res -e 1) {
|
||||||
|
Write-Host "Failed to unload $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