This is a bit of a sledgehammer to crack a nut scenario to get you back up and running on teams. Where we have had to use this is for Tenant to Tenant migrations where the user and their workstation simply wont connect to the new tenant, and it is persistent to the legacy tenant. Also, every now and then we have had our own users just run into stuff that won’t resolve itself with a reboot simple uninstall / uninstall.
It’s most likely that like back in the old days just deleting the cache would do the trick, but belt & braces – go nuclear.
Go to Teams and set it to not auto-start, nor open in background, or stay open when running and don’t have it set for chat app. Then exit the application by right click on the task bar and closing.
Once Teams is uninstalled, the cache files cleared and registry cleared, these should be moot.
Delete these files and folders: C:\Users\[Your Username]\AppData\Local\Microsoft
Delete these files and folders: C:\Users\[Your Username]\AppData\Roaming\Microsoft
Delete these files: C:\Users\[Your Username]\AppData\Roaming
C:\Program Files (x86)\Teams Installer
Optional: Search the Registry and CAREFULLY evaluate and delete any residual keys for Teams or “Microsoft Teams”
File\Account
Navigate to:C:\Users\[your username]\AppData\Local\Packages. Find the folder called something like : Microsoft.AAD.BrokerPlugin_*****
e.g. Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy
Right click and re-name of you can.
# Rename the AAD BrokerPlugin directories to try to avoid TPM errors when using Office
$ProfilesDirectoryPath = (Get-ItemProperty -Path “registry::HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList” -Name ProfilesDirectory).ProfilesDirectory
$ProfileDirectories = Get-ChildItem -Path $ProfilesDirectoryPath -Directory
$UniqueRenameKey = ([guid]::newguid()).tostring().replace(‘-‘,”)
try{
$Renames = (Get-ItemProperty ‘registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager’ -Name PendingFileRenameOperations -ErrorAction SilentlyContinue).PendingFileRenameOperations
if( $Renames ) {
$Renames = $Renames | ? { $_ -notlike ‘*Microsoft.AAD.BrokerPlugin_*’ }
}
} catch {
}
if( -not $Renames ) {
$Renames = @()
}
Foreach( $ProfileDirectory in $ProfileDirectories ) {
$AppDataPackagesPath = (‘{0}\AppData\Local\Packages’ -f $ProfileDirectory.FullName )
if( Test-Path $AppDataPackagesPath ) {
$MicrosoftAADBrokerPluginPackages = Get-ChildItem $AppDataPackagesPath -Directory -Filter ‘Microsoft.AAD.BrokerPlugin_*’
Foreach( $MicrosoftAADBrokerPluginPackage in $MicrosoftAADBrokerPluginPackages ) {
$Renames += (‘\??\{0}’ -f $MicrosoftAADBrokerPluginPackage.FullName)
$Renames += (‘\??\{0}_{1}’ -f $MicrosoftAADBrokerPluginPackage.FullName, $UniqueRenameKey)
}
}
$UserClassPath = (‘{0}\AppData\Local\Microsoft\Windows\UsrClass.dat’ -f $ProfileDirectory.FullName )
if( Test-Path $UserClassPath ) {
$Renames += (‘\??\{0}’ -f $UserClassPath)
$Renames += (‘\??\{0}_{1}’ -f $UserClassPath, $UniqueRenameKey)
}
}
if( $Renames ) {
try{
$DontSave = Get-ItemProperty ‘registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager’ -Name PendingFileRenameOperations -ErrorAction SilentlyContinue
Set-ItemProperty ‘registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager’ -Name PendingFileRenameOperations -Value $Renames
} catch {
New-ItemProperty ‘registry::HKLM\SYSTEM\CurrentControlSet\Control\Session Manager’ -Name PendingFileRenameOperations -Value $Renames -PropertyType MultiString | Out-Null
}
}
You may not want to do this if re-enrolling your device isn’t always a straightforward exercise like you have to be connected to the VPN or have Admin rights to re-enroll it. You may not even be able to unenroll it, so maybe just try a reboot here first before moving to these next steps.
Does Teams automatically reinstall?
No? Good
Go to https://products.office.com/en-gb/microsoft-teams/download-app download and reinstall, or go to https://teams.microsoft.com log in and re-install
Teams Login Issues Mac OS X –
Delete the entry called Microsoft Teams Identities Cache
~/Library/Application Support/Microsoft/Teams/Cache”
~/Library/Application Support/Microsoft/Teams/Application Cache/Cache”
You might need to run this too: How to remove Office license files on a Mac