Set displayname of all users
This commit is contained in:
parent
cb2735b909
commit
dee942b881
1 changed files with 11 additions and 10 deletions
|
@ -83,24 +83,25 @@ $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``…";
|
||||||
|
$displayName = Get-UserConfig -UserName $name "displayName";
|
||||||
|
|
||||||
|
$userArguments = @{
|
||||||
|
name = $name;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($displayName) {
|
||||||
|
$userArguments.fullName = $displayName;
|
||||||
|
}
|
||||||
|
|
||||||
if (Get-UserConfig -UserName $name "microsoftAccount") {
|
if (Get-UserConfig -UserName $name "microsoftAccount") {
|
||||||
Add-MicrosoftAccount $name;
|
Add-MicrosoftAccount $name;
|
||||||
} else {
|
} else {
|
||||||
$displayName = Get-UserConfig -UserName $name "displayName";
|
|
||||||
|
|
||||||
$userArguments = @{
|
|
||||||
name = $name;
|
|
||||||
};
|
|
||||||
|
|
||||||
if ($displayName) {
|
|
||||||
$userArguments.fullName = $displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue