Disable UAC after logging in MS account
This commit is contained in:
parent
e2013f8db5
commit
17939bee8c
|
@ -500,6 +500,7 @@ $null = New-Module {
|
|||
|
||||
if ($currentUser -lt $users.Count) {
|
||||
$user = Get-LocalUser $users[$currentUser];
|
||||
$msAccount = Get-UserConfig -UserName "$user" -Name "microsoftAccount";
|
||||
|
||||
Add-LocalGroupMember `
|
||||
-SID ([SecurityIdentifier]::new([WellKnownSidType]::BuiltinAdministratorsSid, $null))`
|
||||
|
@ -510,7 +511,7 @@ $null = New-Module {
|
|||
Disable-LocalUser $env:UserName;
|
||||
Enable-LocalUser $user;
|
||||
|
||||
if (Get-UserConfig -UserName "$user" -Name "microsoftAccount") {
|
||||
if ($msAccount) {
|
||||
Enable-UAC;
|
||||
Disable-Autologin;
|
||||
Enable-OneShotListener;
|
||||
|
@ -521,6 +522,14 @@ $null = New-Module {
|
|||
|
||||
Restart-Intermediate -DefaultUser;
|
||||
return;
|
||||
} else {
|
||||
if ($msAccount) {
|
||||
if (-not (Test-Admin)) {
|
||||
Invoke-OneShot DisableUAC;
|
||||
Restart-Computer;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Get-UserConfig -UserName "$user" "microsoftAccount")) {
|
||||
|
|
Loading…
Reference in a new issue