Aug 09 2021 07:43 AM - edited Aug 09 2021 07:53 AM
I have a GUI app written in Powershell that works correctly except when I connect to MicrosoftTeams (and even disconnect) then the GUI app process will not end. If I remove the connection to MSTeams the process ends correctly (not in task mgr process list anymore). So I'm confident I've narrowed the issue down to the MSTeams connect/disconnect.
Here is code snipet for connect/disconnect.
$script:msteamsSession = Connect-MicrosoftTeams -Credential $script:O365CredDefault
Disconnect-MicrosoftTeams -Confirm:$false
It does seem to be an issue in non-GUI scripts also.
When I run PS ISE and do MSTeams connect then close PS ISE, the process is still running. Yes I gave it time to shutdown.
Aug 09 2021 09:41 AM
Aug 09 2021 12:25 PM
Aug 12 2021 04:35 PM
SolutionNot ideal or elegant but
Stop-Process -Id $PID
seems to work
Hopefully Microsoft Teams module developers will discover the real problem and fix it.