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