Modify user after first login
This commit is contained in:
parent
4a2753e928
commit
9ec7145dcf
2 changed files with 11 additions and 5 deletions
|
@ -607,10 +607,21 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(([UserStage]::Configure)) {
|
(([UserStage]::Configure)) {
|
||||||
|
$displayName = Get-UserConfig -UserName $name "displayName";
|
||||||
|
|
||||||
|
$userArguments = @{
|
||||||
|
name = $name;
|
||||||
|
};
|
||||||
|
|
||||||
|
if ($displayName) {
|
||||||
|
$userArguments.fullName = $displayName;
|
||||||
|
}
|
||||||
|
|
||||||
$adminGroup = @{
|
$adminGroup = @{
|
||||||
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Set-LocalUser @userArguments;
|
||||||
Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser);
|
Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser);
|
||||||
Remove-LocalGroupMember -Member $name @adminGroup -ErrorAction SilentlyContinue;
|
Remove-LocalGroupMember -Member $name @adminGroup -ErrorAction SilentlyContinue;
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,6 @@ $null = New-Module {
|
||||||
function Initialize-UserCreation {
|
function Initialize-UserCreation {
|
||||||
$name = (@(Get-Users))[(Get-CurrentUser)];
|
$name = (@(Get-Users))[(Get-CurrentUser)];
|
||||||
$msAccount = Get-UserConfig -UserName $name "microsoftAccount";
|
$msAccount = Get-UserConfig -UserName $name "microsoftAccount";
|
||||||
$displayName = Get-UserConfig -UserName $Name "displayName";
|
|
||||||
|
|
||||||
Write-Host "Initializing user ``$name``…";
|
Write-Host "Initializing user ``$name``…";
|
||||||
|
|
||||||
|
@ -132,10 +131,6 @@ $null = New-Module {
|
||||||
name = $name;
|
name = $name;
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($displayName) {
|
|
||||||
$userArguments.fullName = $displayName;
|
|
||||||
}
|
|
||||||
|
|
||||||
$adminGroup = @{
|
$adminGroup = @{
|
||||||
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue