Uninstall Microsoft Teams Machine Wide Installer
Log In or Register to download the BES file, and more.

4 Votes

Description

This fixlet will Uninstall Microsoft Teams Machine Wide Installer and  instances of it on user profiles

Based on the following article - Install Teams using Microsoft Endpoint Configuration Manager - Microsoft Teams | Microsoft Docs


Property Details

ID26840
StatusProduction - Fully Tested and Ready for Production
TitleUninstall Microsoft Teams Machine Wide Installer
SourceInternal
Source Release Date2/26/2021 12:00:00 AM
KeywordsUninstall Microsoft Teams Machine Wide Installer
Added by on 2/28/2021 11:53:04 PM
Last Modified by on 11/15/2023 4:36:53 AM
Counters 6255 Views / 344 Downloads
User Rating 1 star 2 star 3 star 4 star 5 star * Average over 1 rating. ** Log In or Register to add your rating.

Relevance

Used in 1 fixlet   * Results in a true/false
Show indented relevance
(exists file "msiexec.exe" of system folder) AND (disjunction of (exists keys whose ( value "DisplayName" of it as string as lowercase equals "teams machine-wide installer" ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of ( x32 registry; (if exists x64 registry then x64 registry else nothing) ))) AND true

Actions

Action 1 (default)

Action Link Click here to Uninstall Microsoft Teams Machine Wide Installer and Microsoft Teams on all user profiles on the machine.
Script Type BigFix Action Script
delete __createfile
delete __Download\uninstall_Teams_per_machine_guid.txt
delete __Download\uninstall_Teams_per_machine.bat
delete __Download\uninstall_Teams_per_user.bat
delete __Download\uninstall_Teams_per_user_folders.txt
delete __Download\uninstall_Teams_per_user_folders.bat
delete __Download\uninstall_Teams_per_user_registry.txt
delete __Download\uninstall_Teams_per_user_registry.bat
delete __Download\uninstall_Teams_per_machine_registry.txt
delete __Download\uninstall_Teams_per_machine_registry.bat

// Get GUID's of the teams machine-wide installer the Installed on the System
createfile until __END__
{concatenation "%0d%0a" of (names of keys whose (value "DisplayName" of it as string as lowercase equals "teams machine-wide installer") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries))}
__END__
move __createfile __Download\uninstall_Teams_per_machine_guid.txt

// Create Uninstaller based on the GUID's of the teams machine-wide installer (The UninstallString is not Good)
createfile until __END__
{concatenation "%0d%0a" of ("msiexec.exe /X " & it & " /QN") of (lines of file "__Download\uninstall_Teams_per_machine_guid.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_machine.bat

// Get The Registry Keys of the Microsoft Teams per-user
createfile until __END__
{concatenation "%0d%0a" of unique values of (keys whose (value "DisplayName" of it as string as lowercase = "microsoft teams") of keys "Microsoft\Windows\CurrentVersion\Uninstall" of keys ("SOFTWARE";"SOFTWARE\Wow6432node") of keys of keys "HKEY_USERS" of (x32 registries; (if (exists x64 registries) then x64 registries else nothing)) as string)}
{concatenation "%0d%0a" of unique values of (keys "Microsoft\Office\Teams" of keys ("SOFTWARE";"SOFTWARE\Wow6432node") of keys of keys "HKEY_USERS" of (x32 registries; (if (exists x64 registries) then x64 registries else nothing)) as string)}
__END__
move __createfile __Download\uninstall_Teams_per_user_registry.txt

// Gets the Teams Folder on APPDATA , LOCALDATA of those users that have Microsoft Teams installed
createfile until __END__
{concatenation "%0d%0a" of unique values of ((folders "Microsoft\Teams" of (values "APPDATA" of it as folder;values "LOCALAPPDATA" of it as folder) of (keys "Volatile Environment" of parent keys of parent keys of parent keys of parent keys of parent keys of parent keys of keys whose (value "DisplayName" of it as string as lowercase = "microsoft teams") of keys "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of keys of keys "HKEY_USERS" of ( x32 registries; (if (exists x64 registries) then x64 registries else nothing ))) as string))}
__END__
move __createfile __Download\uninstall_Teams_per_user_folders.txt

// Create Delete procedure for the Teams Folder on APPDATA , LOCALDATA of those users that have Microsoft Teams installed
createfile until __END__
{concatenation "%0d%0a" of ("rmdir /S /Q %22" & it & "%22") of (lines of file "__Download\uninstall_Teams_per_user_folders.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_user_folders.bat

// Create Uninstaller for those users that have Microsoft Teams installed (Per-User)
createfile until __END__
{concatenation "%0d%0a" of unique values of ((values "QuietUninstallString" of keys whose (value "DisplayName" of it as string as lowercase = "microsoft teams") of keys "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of keys of keys "HKEY_USERS" of ( x32 registries; (if (exists x64 registries) then x64 registries else nothing )) as string))}
__END__
move __createfile __Download\uninstall_Teams_per_user.bat


// Delete Leftovers - The Registry Keys of the Microsoft Teams per-user
createfile until __END__
{concatenation "%0d%0a" of ("reg delete %22" & it & "%22 /f") of (lines of file "__Download\uninstall_Teams_per_user_registry.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_user_registry.bat

// Delete Procedures
waithidden __Download\uninstall_Teams_per_machine.bat

parameter "error" = "{exit code of action}"
if {parameter "error" = "1612" or parameter "error" = "7" or parameter "error" = "1605"}
// If the MSI was installed without the ALLUSERS=1, trying to uninstall it with the GUID will result this error
// We need to Remove manualy the "Teams Installer" Folder and then it's Registry Key
folder delete "{folder "Teams Installer" of program files x32 folder}"
createfile until __END__
{concatenation "%0d%0a" of (keys whose (value "DisplayName" of it as string as lowercase equals "teams machine-wide installer") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries) as string)}
__END__
move __createfile __Download\uninstall_Teams_per_machine_registry.txt
// Delete Leftovers - The Registry Keys of the Microsoft Teams per-machine
createfile until __END__
{concatenation "%0d%0a" of ("reg delete %22" & it & "%22 /f") of (lines of file "__Download\uninstall_Teams_per_machine_registry.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_machine_registry.bat
waithidden __Download\uninstall_Teams_per_machine_registry.bat
endif

waithidden __Download\uninstall_Teams_per_user.bat
waithidden __Download\uninstall_Teams_per_user_folders.bat
waithidden __Download\uninstall_Teams_per_user_registry.bat
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.

Action 2

Action Link Click here to Uninstall Microsoft Teams Machine Wide Installer only.
Script Type BigFix Action Script
delete __createfile
delete __Download\uninstall_Teams_per_machine_guid.txt
delete __Download\uninstall_Teams_per_machine.bat
delete __Download\uninstall_Teams_per_machine_registry.txt
delete __Download\uninstall_Teams_per_machine_registry.bat

// Get GUID's of the teams machine-wide installer the Installed on the System
createfile until __END__
{concatenation "%0d%0a" of (names of keys whose (value "DisplayName" of it as string as lowercase equals "teams machine-wide installer") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries))}
__END__
move __createfile __Download\uninstall_Teams_per_machine_guid.txt

// Create Uninstaller based on the GUID's of the teams machine-wide installer (The UninstallString is not Good)
createfile until __END__
set errorlevel=
{concatenation "%0d%0a" of ("msiexec.exe /X " & it & " /QN") of (lines of file "__Download\uninstall_Teams_per_machine_guid.txt")}
set SWDExitCode=%errorlevel%
exit %SWDExitCode%
__END__
move __createfile __Download\uninstall_Teams_per_machine.bat

// Delete Procedures
waithidden __Download\uninstall_Teams_per_machine.bat
parameter "error" = "{exit code of action}"
if {parameter "error" = "1612" or parameter "error" = "7" or parameter "error" = "1605"}
// If the MSI was installed without the ALLUSERS=1, trying to uninstall it with the GUID will result this error
// We need to Remove manualy the "Teams Installer" Folder and then it's Registry Key
folder delete "{folder "Teams Installer" of program files x32 folder}"
createfile until __END__
{concatenation "%0d%0a" of (keys whose (value "DisplayName" of it as string as lowercase equals "teams machine-wide installer") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries) as string)}
__END__
move __createfile __Download\uninstall_Teams_per_machine_registry.txt
// Delete Leftovers - The Registry Keys of the Microsoft Teams per-machine
createfile until __END__
{concatenation "%0d%0a" of ("reg delete %22" & it & "%22 /f") of (lines of file "__Download\uninstall_Teams_per_machine_registry.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_machine_registry.bat
waithidden __Download\uninstall_Teams_per_machine_registry.bat
endif
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.

Action 3

Action Link Click here to Uninstall Microsoft Teams on all user profiles on the machine.
Script Type BigFix Action Script
delete __createfile
delete __Download\uninstall_Teams_per_user.bat
delete __Download\uninstall_Teams_per_user_folders.txt
delete __Download\uninstall_Teams_per_user_folders.bat
delete __Download\uninstall_Teams_per_user_registry.txt
delete __Download\uninstall_Teams_per_user_registry.bat

// Get The Registry Keys of the Microsoft Teams per-user
createfile until __END__
{concatenation "%0d%0a" of unique values of (keys whose (value "DisplayName" of it as string as lowercase = "microsoft teams") of keys "Microsoft\Windows\CurrentVersion\Uninstall" of keys ("SOFTWARE";"SOFTWARE\Wow6432node") of keys of keys "HKEY_USERS" of (x32 registries; (if (exists x64 registries) then x64 registries else nothing)) as string)}
{concatenation "%0d%0a" of unique values of (keys "Microsoft\Office\Teams" of keys ("SOFTWARE";"SOFTWARE\Wow6432node") of keys of keys "HKEY_USERS" of (x32 registries; (if (exists x64 registries) then x64 registries else nothing)) as string)}
__END__
move __createfile __Download\uninstall_Teams_per_user_registry.txt

// Gets the Teams Folder on APPDATA , LOCALDATA of those users that have Microsoft Teams installed
createfile until __END__
{concatenation "%0d%0a" of unique values of ((folders "Microsoft\Teams" of (values "APPDATA" of it as folder;values "LOCALAPPDATA" of it as folder) of (keys "Volatile Environment" of parent keys of parent keys of parent keys of parent keys of parent keys of parent keys of keys whose (value "DisplayName" of it as string as lowercase = "microsoft teams") of keys "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of keys of keys "HKEY_USERS" of ( x32 registries; (if (exists x64 registries) then x64 registries else nothing ))) as string))}
__END__
move __createfile __Download\uninstall_Teams_per_user_folders.txt

// Create Delete procedure for the Teams Folder on APPDATA , LOCALDATA of those users that have Microsoft Teams installed
createfile until __END__
{concatenation "%0d%0a" of ("rmdir /S /Q %22" & it & "%22") of (lines of file "__Download\uninstall_Teams_per_user_folders.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_user_folders.bat

// Create Uninstaller for those users that have Microsoft Teams installed (Per-User)
createfile until __END__
{concatenation "%0d%0a" of unique values of ((values "QuietUninstallString" of keys whose (value "DisplayName" of it as string as lowercase = "microsoft teams") of keys "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of keys of keys "HKEY_USERS" of ( x32 registries; (if (exists x64 registries) then x64 registries else nothing )) as string))}
__END__
move __createfile __Download\uninstall_Teams_per_user.bat


// Delete Leftovers - The Registry Keys of the Microsoft Teams per-user
createfile until __END__
{concatenation "%0d%0a" of ("reg delete %22" & it & "%22 /f") of (lines of file "__Download\uninstall_Teams_per_user_registry.txt")}
__END__
move __createfile __Download\uninstall_Teams_per_user_registry.bat

// Delete Procedures
waithidden __Download\uninstall_Teams_per_user.bat
waithidden __Download\uninstall_Teams_per_user_folders.bat
waithidden __Download\uninstall_Teams_per_user_registry.bat
Success Criteria

This action will be considered successful when the applicability relevance evaluates to false.


Sharing

Social Media:
Share this page on Yammer

Comments

Log In or Register to leave comments!
jloosle -
Download error
JamesMoondew -
also cannot download
RAMESHWARPARSAD -
Not Allowing to Download. Accept term and condition is failing.