CAUTION: Microsoft does not provide a programmatic way to sign out of MS Teams desktop client.  This article uses an unsupported script to sign out of MS Teams.  It is not supported by Microsoft or UC Workspace/Quicklaunch.  Please verify it works in your test environments.  If you choose to use it in your production environments realize that it will be a security risk if it fails.  Make sure to evaluate your production environments often to ensure that the script is working properly.



Download and Setup


The Teams Logout script can be downloaded from https://qlinstall.ucworkspace.com/utilities/TeamsLogout.zip


You need to set the PowerShell Execution Policy from Restricted to RemoteSigned to allow local PowerShell scripts to run.

Type Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser  to set the policy to RemoteSigned. 





Running the Teams Logout script on Room Reset in Quicklaunch Ultimate Edition


Note, System Events is a feature of Quicklaunch Ultimate Edition. 


- Unzip and save the TeamsLogout.ps1 script to a permanent directory on the computer

- Navigate to Setting->System->Events

- Add new Action

- Choose "Add Program"

- Choose Event Type - "Room Reset"

- Program Path: Click on the Windows icon (to the right) and find "Windows PowerShell"

- Startup Folder: leave blank

- Arguments: enter the entire directory and name to the TeamsLogout.ps1 script you downloaded above. Example: "&'%ALLUSERSPROFILE%\UC Workspace\TeamsLogout.ps1'"

Display Rules Change State - "Hidden"

- Window Class Equals "ConsoleWindowClass"

- Save


When a room reset is triggered, the Teams Logout script will run.

 



Running the Teams Logout script on Room Reset in Quicklaunch SE and PE Editions


In Quicklaunch Standard and Professional editions, we have added an option to run batch files on Room Reset.


To create a batch file:

- open Notepad

- write powershell  and put the entire directory and name to the TeamsLogout.ps1 script you downloaded above

- save in .bat format


Configure Room Reset to run the batch file:

- Navigate to Setting->System->Reset Room

- Batch: Select the Pre or Post Cleanup Batch File Path

- Save


When a room reset is triggered, the Teams Logout script will run.