Set displayname of all users

This commit is contained in:
Manuel Thalmann 2024-08-09 04:20:00 +02:00
parent cb2735b909
commit dee942b881

View file

@ -83,10 +83,6 @@ $null = New-Module {
Set-SetupOption $userOption $i; Set-SetupOption $userOption $i;
$name = $users[$i]; $name = $users[$i];
Write-Host "Creating personal user ``$name``"; Write-Host "Creating personal user ``$name``";
if (Get-UserConfig -UserName $name "microsoftAccount") {
Add-MicrosoftAccount $name;
} else {
$displayName = Get-UserConfig -UserName $name "displayName"; $displayName = Get-UserConfig -UserName $name "displayName";
$userArguments = @{ $userArguments = @{
@ -97,10 +93,15 @@ $null = New-Module {
$userArguments.fullName = $displayName; $userArguments.fullName = $displayName;
} }
if (Get-UserConfig -UserName $name "microsoftAccount") {
Add-MicrosoftAccount $name;
} else {
New-LocalUser -Disabled -NoPassword @userArguments; New-LocalUser -Disabled -NoPassword @userArguments;
Set-LocalUser $name -PasswordNeverExpires $true; Set-LocalUser $name -PasswordNeverExpires $true;
Set-LocalUser $name -PasswordNeverExpires $false; Set-LocalUser $name -PasswordNeverExpires $false;
} }
Set-LocalUser @userArguments;
} }
} }
}; };