diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 181130c8..7de42953 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -502,8 +502,12 @@ $null = New-Module { $user = Get-LocalUser $users[$currentUser]; $msAccount = Get-UserConfig -UserName "$user" -Name "microsoftAccount"; + $adminGroup = @{ + SID = [SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null); + }; + Add-LocalGroupMember ` - -SID ([SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null))` + @adminGroup ` $user ` -ErrorAction SilentlyContinue; @@ -523,12 +527,23 @@ $null = New-Module { Restart-Intermediate -DefaultUser; return; } else { + $configure = { + Deploy-SoftwareAction -Action ([InstallerAction]::ConfigureUser); + Remove-LocalGroupMember -Member "$user" @adminGroup -ErrorAction SilentlyContinue; + } + if ($msAccount) { if (-not (Test-Admin)) { Invoke-OneShot DisableUAC; Restart-Computer; return; + } else { + & $configure; + Clear-SetupRegistration; + Disable-OneShotListener; } + } else { + & $configure; } }