Refactor user creation process
This commit is contained in:
parent
04c6ef125f
commit
7c1befdef4
1 changed files with 7 additions and 7 deletions
|
@ -60,14 +60,11 @@ function New-PersonalUser([Context] $context, [string] $userName)
|
||||||
Set-LocalUser $context.AdminName -Password (ConvertTo-SecureString -AsPlainText "Admin") &&
|
Set-LocalUser $context.AdminName -Password (ConvertTo-SecureString -AsPlainText "Admin") &&
|
||||||
Disable-LocalUser $context.AdminName;
|
Disable-LocalUser $context.AdminName;
|
||||||
|
|
||||||
Write-Host "Registering setup script for all new users";
|
|
||||||
$context.RegisterNewUserReboot();
|
|
||||||
|
|
||||||
Write-Information "Enabling UAC for the next login (Microsoft Account login won't work otherwise, lol)";
|
|
||||||
Enable-UACNextLogin $context;
|
|
||||||
|
|
||||||
Write-Information "Disabling Auto login";
|
Write-Information "Disabling Auto login";
|
||||||
$context.RemoveAutologin();
|
$context.RemoveAutologin();
|
||||||
|
Write-Host "Registering setup script for all new users";
|
||||||
|
$context.RegisterNewUserReboot();
|
||||||
|
Register-UserPostprocessingTasks $context;
|
||||||
Set-UserStage $disableUACStage;
|
Set-UserStage $disableUACStage;
|
||||||
Restart-Computer -Force;
|
Restart-Computer -Force;
|
||||||
exit;
|
exit;
|
||||||
|
@ -89,7 +86,8 @@ function New-PersonalUser([Context] $context, [string] $userName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Enable-UACNextLogin([Context] $context) {
|
function Register-UserPostprocessingTasks([Context] $context) {
|
||||||
|
Write-Information "Enabling UAC for the next login (Microsoft Account login won't work otherwise, lol)";
|
||||||
$context.SetUACState($true);
|
$context.SetUACState($true);
|
||||||
$tempTask = "PortValhalla Temp";
|
$tempTask = "PortValhalla Temp";
|
||||||
$autoLoginName = "PortValhalla AutoLogin Setup";
|
$autoLoginName = "PortValhalla AutoLogin Setup";
|
||||||
|
@ -100,6 +98,8 @@ function Enable-UACNextLogin([Context] $context) {
|
||||||
$context.Set($autoLoginTriggerProperty, $autoLoginTrigger, "DWord");
|
$context.Set($autoLoginTriggerProperty, $autoLoginTrigger, "DWord");
|
||||||
$context.Set($uacDisablerTriggerProperty, $uacDisablerTrigger, "DWord");
|
$context.Set($uacDisablerTriggerProperty, $uacDisablerTrigger, "DWord");
|
||||||
|
|
||||||
|
Write-Information "Registering tasks for re-enabling autologon and re-enabling UAC on next login";
|
||||||
|
|
||||||
$optionCollection = [System.Tuple[int, string, string[]][]]@(
|
$optionCollection = [System.Tuple[int, string, string[]][]]@(
|
||||||
[System.Tuple]::Create(
|
[System.Tuple]::Create(
|
||||||
$autoLoginTrigger,
|
$autoLoginTrigger,
|
||||||
|
|
Loading…
Reference in a new issue