Microsoft Account EVIL: Difference between revisions

Created page with "...have that urge to track down the people at Microsoft that have messed up Windows 11, and made it infuriatingly impossible to get rid of sign ins? Curb your anger instead and just solve the problem with the below "Thor's Hammer";<syntaxhighlight lang="text"> # THOR HAMMER: remove Microsoft cloud-account identity caches from all local profiles. # Run as Administrator. Reboot happens at the end. $ErrorActionPreference = "SilentlyContinue" # Kill Microsoft identity/clo..."
 
mNo edit summary
Line 1: Line 1:
...have that urge to track down the people at Microsoft that have messed up Windows 11, and made it infuriatingly impossible to get rid of sign ins?  Curb your anger instead and just solve the problem with the below "Thor's Hammer";<syntaxhighlight lang="text">
...have that urge to track down the people at Microsoft that have messed up Windows 11, and made it infuriatingly impossible to get rid of sign ins?  Curb your anger instead and just solve the problem with the below "Thor's Hammer";<syntaxhighlight lang="text">
# THOR HAMMER: remove Microsoft cloud-account identity caches from all local profiles.
 
# Run as Administrator. Reboot happens at the end.


$ErrorActionPreference = "SilentlyContinue"
$ErrorActionPreference = "SilentlyContinue"


# Kill Microsoft identity/cloud consumers
$Procs = @(
$Procs = @(
"OneDrive","msedge","Teams","ms-teams","outlook","olk","winword","excel","powerpnt",
"OneDrive","msedge","Teams","ms-teams","outlook","olk","winword","excel","powerpnt",
Line 15: Line 13:
}
}


# Stop identity/token services where Windows allows it
$Services = @(
$Services = @(
"TokenBroker",
"TokenBroker",
Line 31: Line 28:
dsregcmd /leave 2>$null
dsregcmd /leave 2>$null


# Disable Microsoft consumer/cloud nagging as much as policy allows
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null
New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Force | Out-Null
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name "DisableWindowsConsumerFeatures" -Type DWord -Value 1
Line 44: Line 40:
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "NoConnectedUser" -Type DWord -Value 3
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "NoConnectedUser" -Type DWord -Value 3


# Remove OneDrive machine/user installs
$OneDriveUninstallers = @(
$OneDriveUninstallers = @(
"$env:SystemRoot\System32\OneDriveSetup.exe",
"$env:SystemRoot\System32\OneDriveSetup.exe",
Line 69: Line 64:
}
}


# All profile filesystem cloud-token/cache locations
$Profiles = Get-ChildItem "C:\Users" -Directory | Where-Object {
$Profiles = Get-ChildItem "C:\Users" -Directory | Where-Object {
$_.Name -notin @("Public","Default","Default User","All Users")
$_.Name -notin @("Public","Default","Default User","All Users")
Line 98: Line 92:
}
}


# Loaded user hives: remove Microsoft identity registry stores
$HiveRoots = Get-ChildItem Registry::HKEY_USERS | Where-Object {
$HiveRoots = Get-ChildItem Registry::HKEY_USERS | Where-Object {
$_.Name -match 'S-1-5-21|\.DEFAULT'
$_.Name -match 'S-1-5-21|\.DEFAULT'
Line 121: Line 114:
}
}


# Offline user hives: load NTUSER.DAT, purge identity stores, unload
foreach ($Profile in $Profiles) {
foreach ($Profile in $Profiles) {
$NtUser = "$($Profile.FullName)\NTUSER.DAT"
$NtUser = "$($Profile.FullName)\NTUSER.DAT"
Line 150: Line 142:
}
}


# Remove Microsoft cloud/account app packages for all users where removable
$Packages = @(
$Packages = @(
"Microsoft.OneDriveSync",
"Microsoft.OneDriveSync",