In cases where a motherboard was replaced and Office apps are not activating, this will rename the AADBrokerPlugin folder which gets recreated on next login.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
<# .NOTES =========================================================================== Created on: 05/12/2022 Created by: Jeff Irvine Organization: Techmological Filename: Repair-AADBrokerPlugin.ps1 =========================================================================== .DESCRIPTION In cases where a motherboard was replaced and Office apps are not activating, this will rename the AADBrokerPlugin folder which gets recreated on next login. User must NOT be signed in while this script runs. You must supply the script with a username in short form. ie. username .EXAMPLE Repair-AADBrokerPlugin.ps1 username #> #Requires -RunAsAdministrator param ( [string]$user ) if ($user){ $results = query user $user 2>&1 if ($results -match "No User exists"){ $BrokerPath = "C:\Users\$user\AppData\Local\Packages\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy" if (Test-Path $BrokerPath){ Write-Host "Renaming AADBrokerPlugin folder" Rename-Item $BrokerPath $($BrokerPath + ".old") } else { Write-Warning "Could not find the path to the $user AAD BrokerPlugin directory. Check the username and try again." exit 1 } } else{ throw "The specified user is signed in. Sign the user out of the PC and run this script again." } } else { throw "No username was entered. Please enter the short username and run this script again." } |