• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
ControlUp Community

ControlUp Community

Connect, Learn, and Grow

  • Blog
  • Podcast
  • Meetups
  • Archives
  • Categories
    • ControlUp One Platform
    • ControlUp for Apps
    • ControlUp for Compliance
    • ControlUp for Desktops
    • ControlUp Scripts & Triggers
    • ControlUp Synthetic Monitoring
    • ControlUp for VDI
  • Topics
  • Events
    • Logos & Wallpaper
    • ControlUp.com
  • Join

New script that with CVAD + Teams troubleshooting help

Posted on June 30, 2023

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:

  1. Show a popup stating "Teams cache is being deleted! Please do not launch Teams until completed" – Close this popup/window when script completes
  2. enumerate all Teams.exe processes and kill them
  3. delete . from %appdata%\roaming\microsoft\teams
  4. 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 for Desktops, ControlUp Scripts & Triggers
Topics: Microsoft, Physical Desktops, PowerShell, Reporting, Scripts, Unified Communications

Ask Us Anything, Connect, Learn, and Grow with the ControlUp Community!

Login to the ControlUp Community to ask us anything, stay up-to-date on what’s new and coming soon and meet other like-minded techies like you.

Not already a member? Join Today!

Primary Sidebar

ControlUp Academy

Enroll in ControlUp Academy for expert-led technical training, equipping you with skills to effectively deploy, manage, and grow your ControlUp investment.

Learn here >

Rotating Images

Hidden Gem from our Community on Slack!

ControlUp Betas - What's Coming Next?
NEW ControlUp Features - Stay Up-to-Date!
ControlUp Scripts - Scripting, Zero to Hero
Latest KB Articles - Be the First to Learn
Did you Know - with Sivan Kroitoru
Practical Perspectives Technical Use Case Training

Video Tutorials Library

Visit our technical how-to videos, offering step-by-step tutorials on advanced features, troubleshooting, and best practices.

Watch here >

ControlUp Blog

Check out the ControlUp blog for expert advice and in-depth analysis.

Read here >

ControlUp Script Library

Visit the ControlUp technical script library, which offers a multitude of pre-built scripts and custom actions for your monitoring and troubleshooting requirements.

See here >

ControlUp Support

Visit the ControlUp support home and to delve deeper into ControlUp solutions.

Browse here >

Download ControlUp RealTime DX

Start with ControlUp for real-time end-user environment insights, swift troubleshooting, and unprecedented performance optimization. Download now.

Download here >

Footer

      

ControlUp Community
Of Techie, By Techie, For Techie!

Terms of Use | Privacy Policy | Security
Dive Deeper, Learn more at ControlUp.com

  • facebook
  • twitter
  • youtube
  • linkedin

© 2023–2025 ControlUp Technologies LTD, All Rights Reserved.

We use cookies to ensure that we give you the best experience on our website. by continuing to use this site you agree to our Cookie policy..