ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 1 year and 7 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.
pascalsyl
Posts: 4
Last visit: Tue Feb 27, 2024 11:19 am

ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by pascalsyl »

To help you better we need some information from you.

Product, version and build: PowerShell Studio 5.8.209
Operating system: Windows Server 2019
PowerShell version(s):5.1.17763.2931

Application developed with PowerShell Studio
does not connect to the Exchange Online Module version 2.0.4 and 2.0.5
We use a modern auth connection via certificate and not in basic authentication see below
Connect-ExchangeOnline -AppId $ApplicationID -CertificateThumbprint $Thumbprint -Organization $Organization -ShowProgress $true -CommandName * -FormatTypeName *

We have to use this command with the Exchange Online module version 2.0.3 for it to work

The problem is that all versions of the module below 2.0.5 are deprecated from 31/08/2022

Thanks in advance for your help



DO NOT POST LICENSES, KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 9:46 am
Answers: 39
Been upvoted: 30 times

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by brittneyr »

Most connections like these generally need to be made before the creation of the form.
You may find the following helpful:
viewtopic.php?p=82682&hilit=Connect+Exc ... ine#p82682
viewtopic.php?t=15297

Is this a project, ps1 or psf file?
Brittney
SAPIEN Technologies, Inc.
pascalsyl
Posts: 4
Last visit: Tue Feb 27, 2024 11:19 am

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by pascalsyl »

Hello,

Thanks for your feedback.

The project is build in .exe.

I tried to set the connexion before the creation of the form as you said but when i run the exe the form is not displayed.

The strange thing is that it works without problem with the powershell module ExchangeOnlineManagement 2.0.3 but with 2.0.4 and 2.0.5 it does not work.

I read the other topics, but it doesn't really answer my problem.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 9:46 am
Answers: 39
Been upvoted: 30 times

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by brittneyr »

From my research, this is a problem with PowerShell v5.1 and the ExchangeOnlineManagement module being version 2.0.4 or later. There is a little we can do to help with this as these are both Microsoft.
The only known fixes are to downgrade ExchangeOnlineManagement or upgrade to use PowerShell 7.
Brittney
SAPIEN Technologies, Inc.
pascalsyl
Posts: 4
Last visit: Tue Feb 27, 2024 11:19 am

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by pascalsyl »

Hello,

Thank you for your feedback.

I don't agree with your opinion. If there was a real problem between exchange Module and Powerhsell Version, I could not run the commands in a full powershell environment without a graphical interface made with Powershell Studio.

I have done all the tests possible, the only time it doesn't work is when I use the Powershell Studio sources.
User avatar
Alexander Riedel
Posts: 8479
Last visit: Thu Mar 28, 2024 9:29 am
Answers: 19
Been upvoted: 37 times

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by Alexander Riedel »

Brittney is correct and you can try that yourself. There is no problem between the Microsoft Exchange module and Microsoft Windows PowerShell, however there is an issue with
the Microsoft Windows PowerShell threading model and combining it with Microsoft Windows Forms and the Microsoft Exchange module.
These are three Microsoft components interacting, so I can only suggest that this question is better suited for the Microsoft Exchange support team.
They are after all the only ones who would be able to make any changes to the module.

As you are implying that our generated PowerShell code is somewhere or somehow incorrect and causing this issue, please indicate precisely where you think that happens. We are more than happy to evaluate any information you can provide.
Alexander Riedel
SAPIEN Technologies, Inc.
pascalsyl
Posts: 4
Last visit: Tue Feb 27, 2024 11:19 am

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by pascalsyl »

Thank you for your feedback.

Calling the Exchange module does not generate any Windows Form. I don't use MFA, but certificate based authentication. In this case, the thumbprint of the certificate is retrieved from the personal store of the current user and is used to log in. There is no authentication window that opens.

When I run the commands in debug mode, the module does not load correctly. The module crashes after a certain step.
I'm going to report this to Microsoft support. I hope they can find a solution.

But I still note that it is strange that this happens only when I use a code created from Powershell Studio.
User avatar
brittneyr
Site Admin
Posts: 1655
Last visit: Thu Mar 28, 2024 9:46 am
Answers: 39
Been upvoted: 30 times

Re: ExchangeOnlineManagement 2.0.4 or 2.0.5 connection Freeze

Post by brittneyr »

The error will also happen with the following code:
  1. Add-Type -AssemblyName System.Windows.Forms
  2. $FormMain = New-Object System.Windows.Forms.Form
  3. Connect-ExchangeOnline
As previously stated, the issue is not the code generated by PowerShell Studio. It is a threading issue when running a GUI while attempting to connect.

Reporting and getting support from the Microsoft team is the best option. You can get support from here:
https://docs.microsoft.com/en-us/answers/products/
Brittney
SAPIEN Technologies, Inc.
This topic is 1 year and 7 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.