Link to home
Start Free TrialLog in
Avatar of agradmin
agradmin

asked on

Disabling Microsoft Teams on terminal server

We are being impacted on a terminal server by  MS Teams starting automatically as users log in for the first time. With a growing need to support remote staff this is becoming an issue with excessive memory (~500Mb/user) and disk use (50Mb+++ for each user).
We already have users disable auto start one they log in for the first time, but this requires user action and does not prevent the excessive 500Mb or so disk use (under user profile/appdata).

Users do not need/should not be using Teams on the terminal server

My question comes in 2 parts;
1) How can we best disable Teams from auto starting when a user logs in for the first time (though GPO?)
2) Is there an easy way to clean up existing disk space under the user's appdata (roaming/local) folder? Some users are using in excess of 1Gb (and each new user ~ 500Mb)?

Thanks in advance for your expert help. I know we are not alone facing this issue......... thanks Microsoft!

Avatar of James Rankin
James Rankin
Flag of United Kingdom of Great Britain and Northern Ireland image

Of course, reading your comment fully now I am back at home - why don't you just uninstall Teams from the RDSH server, if they shouldn't be using it?
And if you have users that have installed the user-based version of Teams and need it removing from their profile, there is this https://github.com/Deyda/Microsoft/blob/master/Teams/Teams-UserBasedCleanUp.ps1
Avatar of agradmin
agradmin

ASKER

Thanks James. We have actually tried uninstalling Teams but this has to be done on a per/user basis. If we could uninstall altogether that would be ideal. We do have some users that use some O365 apps (Outlook etc) on this server, our guess is that this connection is tied somehow with Teams download/installation for all.

Your (excellent) article has an emphasis on setting Teams not to auto-start unless opened manually first, we are looking for it not to auto start full stop (and then clean up disk use for existing users).

Is there anything specific you can offer to help achieve this? We are under a time crunch with a number of the balls we currently have in the air so it's hard to devote time to read and pick out the pieces that apply.

Excellent article though, very helpful in understanding - I will read in-depth when I can come up for air........
ASKER CERTIFIED SOLUTION
Avatar of James Rankin
James Rankin
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You need to actually uninstall the Teams Machine Wide Installer so that it doesn't keep installing it for every newly logged in user.  Removing Microsoft Teams from each user is tedious, since they're installed within each individual user's profile only, not system wide.

Thanks James, I have removed the "Teams Machine Installer"  and that seems to have done the trick when testing a new user logon (profile = 89Mb vs an initial 370Mb for a user added yesterday).

Now for cleanup - we don't have any users downloading and installing Teams on an individual basis (server is used to run ERP app locally for remote users). Can you suggest an appropriate script to help with that? The vast amount of Teams data we are seeing resides in %appdata%/roaming (and local)/Microsoft/Teams.

Thanks again for sharing your expertise on this matter.
The cleanup script I linked in an earlier comment may do the trick?
for /f "delims=|" %f in ('dir /B /A:D-H-R c:\users') do echo "C:\Users\%f\AppData\Microsoft\Teams\*"
That would just remove the folder in APPDATA, it wouldn't remove anything that may exist in the Registry though. Hence why I suggested the full cleanup script.
Thanks James. Do you know how the PS script runs? Is this run as an admin where the username variable can be defined? Would this clean up for a single user?
Sorry James, can you point me to the full cleanup script? I followed your earlier link for the script in question;

https://github.com/Deyda/Microsoft/blob/master/Teams/Teams-UserBasedCleanUp.ps1 
How about this?
https://www.alphr.com/how-to-uninstall-microsoft-teams/

### Get all Users
$Users = Get-ChildItem -Path “$($ENV:SystemDrive)\Users”

#### Process all the Users
$Users | ForEach-Object {
 Write-Host “Process user: $($_.Name)” -ForegroundColor Yellow
 #Locate installation folder
 $localAppData = “$($ENV:SystemDrive)\Users\$($_.Name)\AppData\Local\Microsoft\Teams”
 $programData = “$($env:ProgramData)\$($_.Name)\Microsoft\Teams”

 If (Test-Path “$($localAppData)\Current\Teams.exe”)
 {
 unInstallTeams($localAppData)
 }
 elseif (Test-Path “$($programData)\Current\Teams.exe”) {
 unInstallTeams($programData)
 }
 else {
 Write-Warning “Teams installation not found for user $($_.Name)”
 }
}

Open in new window


Thanks all, as I need to have some control and assurances I have started deleting 'Teams' from %appdata%\Local (& Roaming)\Microsoft  (after testing) for the largest users. This releases the vast majority of disk space used and allows me to select the individuals I know will not be impacted.
Once comfortable with the result I plan to perform for all where it makes sense.