Connect-Teams under a GUI button?


I am a beginner in Powershell and I want to connect to the Teams module with a click of a button in a GUI.

Now I tried to do that with a GUI, a Button and the CMDLet Connect-MicrosoftTeams in a Function.
That function I attached to the AddClick method.

But then when i click on the button, there is no popup to login into Teams module.

So i just wanted to ask if it’s even possible to do that?


Difficult to assist without showing the code. Have you confirmed the on_click works for anything like a 'Hello World" or something simple?