This commit is contained in:
2023-11-06 13:22:16 +01:00
parent 066a397573
commit e571f6fa18

View File

@@ -9,6 +9,7 @@ function UserReg {
if ($null -ne $UserProfile) {
$UserSID = $UserProfile.SID
if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) {
Write-Host "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) {
Write-Host "Failed to load $Username's HKU registry hive."
@@ -86,6 +87,7 @@ function SetupEleveReg {
}
Write-Host "Added registry entries"
Write-Host "Unloading registry HIVE"
Write-Host "REG UNLOAD HKEY_USERS\$UserSID"
$res = REG UNLOAD HKEY_USERS\$UserSID
if ($res -ne 0) {
Write-Host "Failed to unload $username's HKU registry hive."