Question

Classic Teams Uninstall

  • 25 January 2024
  • 0 replies
  • 53 views

Badge

I have a full script that uninstalls Teams classic as Microsoft is pushing the new teams however I cannot get it to work properly by breaking it up. I put this in for the evaluation and remediation - could someone with automox savviness assist?

 

Evaluation

#Locate installation folder
$localAppData = "$($env:LOCALAPPDATA)\Microsoft\Teams"
$programData = "$($env:ProgramData)\$($env:USERNAME)\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"
}

Remediation

function unInstallTeams($path) {
$clientInstaller = "$($path)\Update.exe"

try {
$process = Start-Process -FilePath "$clientInstaller" -ArgumentList "--uninstall /s" -PassThru -Wait -ErrorAction STOP
if ($process.ExitCode -ne 0)
{
Write-Error "UnInstallation failed with exit code $($process.ExitCode)."
}
}
catch {
Write-Error $_.Exception.Message
}
}

 


0 replies

Be the first to reply!

Reply