Delete all Microsoft.AAD.BrokerPluginWindows – O365

Hello, sometimes if you migrate the backup of the PC to the new PC you can get trouble with the activation of the O365. Or if you need to change the main user of the PC. The problem could be in the BrokerPlugin which keeps the old user as an authorized user. There is a simple power-shell script to run as admin to delete all the BrookerPlugins folders.

Get-ItemProperty -Path "C:\Users\*\AppData\Local\Packages" | ForEach-Object {Remove-Item -Path "$_\Microsoft.AAD.BrokerPlugin*" -Recurse -Force | Out-Null
}