Connect-MicrosoftTeams not creating the login window

Use this forum to ask questions after your subscription maintenance expires or before you buy. Need information on licensing or pricing? Questions about a trial version? This is the right place for you. No scripting questions, please.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
code20runner
Posts: 20
Last visit: Thu Jul 28, 2022 11:52 am

Connect-MicrosoftTeams not creating the login window

Post by code20runner »

I am working on an application that calls the Connect-MicrosoftTeams module for Powershell 5.1. However, when I launch the application, it just hangs. I have tried the following versions of Connect-MicrosoftTeams and I have ensured that each module showed in both the Object Viewer and the Cache and nothing has worked.
3.0.0
2.6.0
2.5.1
2.2.0-preview

I am using PowerShell Studio 2019, version 5.6.160. Any guidance/assistance would be super appreciated.

Regards,
Roger
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Connect-MicrosoftTeams not creating the login window

Post by brittneyr »

How are you trying to connect? By the console? From a script? From a psf file?

If you are trying to connect from the console, it important that I say that PowerShell Studio's embedded consoles do not function the same as in the ISE. Rather than being connected, the console and the editor run under different runspaces. For the editor specifically, it runs under a new runspace on every run. This was done intentionally to prevent runspace corruption. Nothing that is imported in the embedded console from the Console panel will affect a script when running (Ctrl+F5) or debugging (F5) unless you are always running the script in the console (Ctrl+F8).

Microsoft 365 module connections generally hang in GUI environments. For more helpful information, please look at the following post: viewtopic.php?t=15297
Brittney
SAPIEN Technologies, Inc.
User avatar
code20runner
Posts: 20
Last visit: Thu Jul 28, 2022 11:52 am

Re: Connect-MicrosoftTeams not creating the login window

Post by code20runner »

Brittney,

I am running the application from within PowerShell Studio, so I would expect it to function just like any other app and not run in the PowerShell Studio console.

I have followed the information in the linked thread but that doesn't seem to resolve the issue. Do I need to upgrade to the latest version of PowerShell Studio to get it to work?

Roger
User avatar
code20runner
Posts: 20
Last visit: Thu Jul 28, 2022 11:52 am

Re: Connect-MicrosoftTeams not creating the login window

Post by code20runner »

Anyone with any ideas on how to overcome this problem? Is it a software version issue?
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Connect-MicrosoftTeams not creating the login window

Post by brittneyr »

Are you running a script or form? Can you please provide a screenshot of what you are seeing?
Brittney
SAPIEN Technologies, Inc.
User avatar
code20runner
Posts: 20
Last visit: Thu Jul 28, 2022 11:52 am

Re: Connect-MicrosoftTeams not creating the login window

Post by code20runner »

Brittney,

I am running the code from a form. When I run the Connect-MicrosoftTeams from within the Powershell ISE, I get the Office365 log-in credentials window. When I press the green "RUN" triangle and try to run the same command from my form, the application locks up and I have to use "Task Manager" to end the task.

I have attached a picture of the code.

Thanks,
Roger
Attachments
Connect-MicrosoftTeams Info.PNG
Connect-MicrosoftTeams Info.PNG (144.51 KiB) Viewed 10880 times
User avatar
brittneyr
Site Admin
Posts: 1654
Last visit: Wed Mar 27, 2024 1:54 pm
Answers: 39
Been upvoted: 30 times

Re: Connect-MicrosoftTeams not creating the login window

Post by brittneyr »

Please trying moving the Connect-MicrosoftTeams command to the Startup.pss file so the connection can be created before the form is initialized.
Brittney
SAPIEN Technologies, Inc.
This topic is 2 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.