From 96818ef7024db8210b84c9e0ca62ec9fa8a9f536 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 27 Aug 2024 03:27:54 +0200 Subject: [PATCH] Modify user after first login --- scripts/Windows/OS/Install.ps1 | 11 +++++++++++ scripts/Windows/Scripts/Users.ps1 | 5 ----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index da8ea96e..e43b9ef9 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -604,10 +604,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 108284af..5335a85d 100644 --- a/scripts/Windows/Scripts/Users.ps1 +++ b/scripts/Windows/Scripts/Users.ps1 @@ -123,7 +123,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``…"; @@ -131,10 +130,6 @@ $null = New-Module { name = $name; }; - if ($displayName) { - $userArguments.fullName = $displayName; - } - $adminGroup = @{ SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null); };