diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 3fb03558..f1a6e0b2 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -607,10 +607,21 @@ $null = New-Module { } } (([UserStage]::Configure)) { + $displayName = Get-UserConfig -UserName $name "displayName"; + + $userArguments = @{ + name = $name; + }; + + if ($displayName) { + $userArguments.fullName = $displayName; + } + $adminGroup = @{ SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null); }; + Set-LocalUser @userArguments; Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser); Remove-LocalGroupMember -Member $name @adminGroup -ErrorAction SilentlyContinue; diff --git a/scripts/Windows/Scripts/Users.ps1 b/scripts/Windows/Scripts/Users.ps1 index a2b61d09..d4fa8b0f 100644 --- a/scripts/Windows/Scripts/Users.ps1 +++ b/scripts/Windows/Scripts/Users.ps1 @@ -124,7 +124,6 @@ $null = New-Module { function Initialize-UserCreation { $name = (@(Get-Users))[(Get-CurrentUser)]; $msAccount = Get-UserConfig -UserName $name "microsoftAccount"; - $displayName = Get-UserConfig -UserName $Name "displayName"; Write-Host "Initializing user ``$name``…"; @@ -132,10 +131,6 @@ $null = New-Module { name = $name; }; - if ($displayName) { - $userArguments.fullName = $displayName; - } - $adminGroup = @{ SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null); };