diff --git a/scripts/Windows/OS/User/Add.ps1 b/scripts/Windows/OS/User/Add.ps1 index 974d1529..8daf925b 100644 --- a/scripts/Windows/OS/User/Add.ps1 +++ b/scripts/Windows/OS/User/Add.ps1 @@ -74,9 +74,9 @@ function New-PersonalUser([Context] $context, [string] $userName) } $postProcessStage { Enable-PersonalUserAutologon $context $userName; - $context.RegisterReboot(); Set-UserStage $adminRemovalStage; Start-EventDrivenTask $context.Get($uacDisablerTriggerProperty); + $context.Reboot(); exit; } $adminRemovalStage { diff --git a/scripts/Windows/OS/User/AutoLogin.ps1 b/scripts/Windows/OS/User/AutoLogin.ps1 index 780fb130..f6970ede 100644 --- a/scripts/Windows/OS/User/AutoLogin.ps1 +++ b/scripts/Windows/OS/User/AutoLogin.ps1 @@ -10,4 +10,8 @@ $context = [Context]::new(); $userName = $context.Get($PreparedUsernameProperty); $password = $context.Get($PreparedSecretProperty); $context.SetAutologin($userName, $password); +$context.Remove($PreparedUsernameProperty); +$context.Remove($PreparedSecretProperty); +Unregister-ScheduledTask -Confirm:$false $AutoLoginTaskName; Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username"; +$context.Remove($AutoLoginTriggerProperty); diff --git a/scripts/Windows/OS/User/UACDisabler.ps1 b/scripts/Windows/OS/User/UACDisabler.ps1 index fce7b677..172f5cf6 100644 --- a/scripts/Windows/OS/User/UACDisabler.ps1 +++ b/scripts/Windows/OS/User/UACDisabler.ps1 @@ -9,11 +9,8 @@ param ( . "$PSScriptRoot/../../Scripts/Context.ps1"; $context = [Context]::new(); -Unregister-ScheduledTask -Confirm:$false $AutoLoginTaskName; -Unregister-ScheduledTask -Confirm:$false $UACDisablerTaskName; $context.SetUACState($false); -$context.Remove($AutoLoginTriggerProperty); +Unregister-ScheduledTask -Confirm:$false $UACDisablerTaskName; +Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username"; $context.Remove($UACDisablerTriggerProperty); $context.DeregisterNewUserReboot(); -Write-EventLog -LogName Application -Source "Application" -EventId $EventID -Message "This event was created by $env:Username"; -Restart-Computer -Force; \ No newline at end of file