Modify user after first login

This commit is contained in:
Manuel Thalmann 2024-08-27 03:27:54 +02:00
parent c0d5d11c56
commit 91e8340deb
2 changed files with 11 additions and 5 deletions

View file

@ -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;

View file

@ -121,7 +121,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``";
@ -129,10 +128,6 @@ $null = New-Module {
name = $name;
};
if ($displayName) {
$userArguments.fullName = $displayName;
}
$adminGroup = @{
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
};