Prevent reading nix
config multiple times
This commit is contained in:
parent
95b0f0994e
commit
7535c40a8d
2 changed files with 13 additions and 6 deletions
|
@ -398,7 +398,12 @@ $null = New-Module {
|
|||
}
|
||||
([UserStage]::Create) {
|
||||
if ($env:UserName -ne $name) {
|
||||
New-ValhallaUser $name;
|
||||
$userInfo = @{
|
||||
name = $name;
|
||||
msAccount = $msAccount;
|
||||
};
|
||||
|
||||
New-ValhallaUser @userInfo;
|
||||
|
||||
if ($msAccount) {
|
||||
logoff;
|
||||
|
|
|
@ -13,10 +13,14 @@ $null = New-Module {
|
|||
|
||||
.PARAMETER Name
|
||||
The name of the user to create.
|
||||
|
||||
.PARAMETER MSAccount
|
||||
A value indicating whether the user should be created as a Microsoft Account.
|
||||
#>
|
||||
function New-ValhallaUser {
|
||||
param(
|
||||
[string] $Name
|
||||
[string] $Name,
|
||||
[switch] $MSAccount
|
||||
)
|
||||
|
||||
function Add-MicrosoftAccount {
|
||||
|
@ -84,9 +88,7 @@ $null = New-Module {
|
|||
Set-MSAccountName ([string]$newUser);
|
||||
}
|
||||
|
||||
$msAccount = Get-UserConfig -UserName $Name "microsoftAccount";
|
||||
|
||||
if ($msAccount) {
|
||||
if ($MSAccount) {
|
||||
if (Test-Admin) {
|
||||
Write-Host "Preparing environment for creating MS Account";
|
||||
Register-Setup -DefaultUser;
|
||||
|
@ -105,7 +107,7 @@ $null = New-Module {
|
|||
|
||||
Write-Host "Creating personal user ``$Name``…";
|
||||
|
||||
if ($msAccount) {
|
||||
if ($MSAccount) {
|
||||
Add-MicrosoftAccount $Name;
|
||||
Set-SetupOption $loggedInUserOption $env:UserName;
|
||||
Invoke-OneShot ([OneShotTask]::InitializeMSAccount);
|
||||
|
|
Loading…
Reference in a new issue