A user suggested creating a new script to resolve issues with Teams by clearing the cache, running a bat file to kill Teams processes, delete the cache folder, and restart Teams in the public desktop for easy user access. An EdgeDX script already exist that does this. ControlUp does not have user initiated scripts, but the bat file can be dropped on their desktop. The EdgeDX script can be found below.
Read the entire ‘Resolving Teams Issues with a New Script’ thread below:
My fancy idea for a new script that others with CVAD + Teams would find handy. This is probably an easy one but i’m not the best at PS:
We constantly have issues with Teams that can normally be resolved by clearing teams cache – del AppData\Roaming\Microsoft\Teams.*.
script steps:
- Show a popup stating "Teams cache is being deleted! Please do not launch Teams until completed" – Close this popup/window when script completes
- enumerate all Teams.exe processes and kill them
- delete . from %appdata%\roaming\microsoft\teams
- Restart Teams "C:\Program Files (x86)\Microsoft\Teams\Update.exe" –processStart "Teams.exe" –allUsers –process-start-args "–system-initiated"
You don’t need Powershell for this. This could be a simple bat file with the first line being "echo Teams cache is being deleted!" followed by taskkill, then del, then update.exe.
Assign an action to sessions, and execution context to user session. I didn’t finish this but you should get the idea.
We want this on the public desktop so they can do it at will without having to track down an admin
don’t we already have a script for this? Might be in edge dx though
ControlUp doesn’t have user initiated scripts but you could drop that bat file on their desktop.
Yes, it’s an EdgeDX script:
“`#require -version 3.0
.SYNOPSIS
Clears Team cache folder contents
.DESCRIPTION
Closes Teams if it is open, clears the content of the cache folder and launches Teams again.
.NOTES
Version: 1.0
Author: Ton de Vreede
Creation Date: 2022-12-13
Credits: Rudy Mens ()
>
$ErrorActionPreference = ‘Stop’
Set output encoding to ensure non-ASCII characters are captured
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
Stop Teams. If this errors, Teams was not running in the first place.
If for some reason Teams IS still running not much we can do about that, try to clear as much as possible anyway
Stop-Process -Name ‘Teams’ -Force -ErrorAction SilentlyContinue
Give it 5 seconds to close
Start-Sleep -Seconds 5
try {
# Try to remove all items in the Teams cache folder
Get-ChildItem -Path "$($env:APPDATA)\Microsoft\teams" | Remove-Item -Recurse -Confirm:$false
Write-Output -InputObject "### SIP EVENT BEGINS ###nTeams cache has been cleared and Teams will be relaunched.n### SIP EVENT ENDS ###"
}
catch {
Write-Output -InputObject "### SIP EVENT BEGINS ###nFailed to delete all items in Teams cache folder. Teams will be relaunched. The reported exception is:n$_`n### SIP EVENT ENDS ###"
}
Relaunch teams
Start-Process -FilePath $env:LOCALAPPDATA\Microsoft\Teams\current\Teams.exe
Exit 0“`
Continue reading and comment on the thread ‘New script that with CVAD + Teams troubleshooting help’. Not a member? Join Here!
Categories: All Archives, ControlUp Edge DX, ControlUp Scripts & Triggers