Rearrange UAC disablement
This commit is contained in:
parent
2dbd1a9fed
commit
775f6a1c10
1 changed files with 2 additions and 2 deletions
|
@ -50,6 +50,7 @@ function New-PersonalUser([Context] $context)
|
|||
Enable-CurrentUserAutologon $context;
|
||||
Write-Information "Removing Admin Account";
|
||||
Get-CimInstance -ClassName "Win32_UserProfile" -Filter "SID = $((Get-LocalUser $context.AdminName).SID)" | Remove-CimInstance;
|
||||
$context.RegisterReboot();
|
||||
Write-EventLog -LogName Application -Source "Application" -EventId $taskTrigger -Message "This event was created by $env:Username";
|
||||
exit;
|
||||
}
|
||||
|
@ -84,8 +85,7 @@ function Enable-UACNextLogin([Context] $context) {
|
|||
"Unregister-ScheduledTask -Confirm:`$false '$uacDisablerName';",
|
||||
". '$PSScriptRoot/../Scripts/Context.ps1';",
|
||||
"`$context = [Context]::new();",
|
||||
"`$context.EntryPoint = '$($context.EntryPoint)';",
|
||||
"`$context.RegisterReboot((Get-Item 'Registry::HKEY_USERS\$((Get-LocalUser $context.UserName).SID)'));",
|
||||
"`$context.DeregisterNewUserReboot();",
|
||||
"Restart-Computer -Force;")));
|
||||
|
||||
schtasks /Create /SC ONEVENT /EC Application /MO "*[System[Provider[@Name='Application'] and EventID=$taskTrigger]]" /TR cmd.exe /TN "$tempTask";
|
||||
|
|
Loading…
Reference in a new issue