Powershell ISE Freezes when MFA is Enabled
After enabling MFA for our accounts now everyone has issues using the PowerShell ISE tool with the MSOnline modules. About 5-15 minutes after loading the MSOnline module and making the connection using Connect-MSOLService the entire ISE window will freeze and you have to use task manager to kill it. If you disable MFA for the user account in use then the problem goes away. This is using the latest versions of the cmdlets and on a Windows 10 Creators update computer. This has been an on-going issue since PowerShell 4.0. It appears to be related to an issue with WinForms in PowerShell. This is only in the ISE window. If using a normal PowerShell window then the issue is not seen.
Is there any solution for this in the near future?
Hi, is it a solution for this soon ?
Is there any solution/ workaround available ?
Ridvan Coban commented
-mta switch did not fix it for me. It still freezes.
the "-mta" switch is the fix for the ISE hanging issue with O365. This whole thread is moot so long as you use 3.0 or greater.
Starts Windows PowerShell ISE using a multi-threaded apartment. This parameter is introduced in Windows PowerShell 3.0. Single-threaded apartment (STA) is the default.
Joshua Drake commented
Having this issue in Console too
Michael J.P. is right!! Running Powershell ISE with the -Mta switch makes a difference! Finally I can run a script for longer than 15 minutes.
Michael J.P. commented
Create a shortcut and run Powershell ISE with this switch.
My Powershell used to lock up after only a few minutes, now I can go hours again.
And yes still using MFA.
Richard G commented
Microsoft's response is weak. Most administrators do not use powershell because the want to play around with scripting. They use it because of lack of development in O365. Microsoft should fix the issue an not recommend purchasing another product.
Thomas Boomer commented
This is the most annoying thing about Microsoft. They release buggy software and do nothing to fix it, even when the problem is well known and thoroughly documented. Case in point is MMC or Microsoft Management Console which constantly locks up and crashes and has since it was introduced.
PowerShell ISE is a similar problem.
Come on Microsoft, fix your sh!t.
My colleague and I have the same issue. Hope this is fixed soon.
Clark Hennaut commented
Same issue… very frustrating to use PowerShell ISE….
I removed my votes after reading Microsoft's response. I believe they are right in pointing out that scripts should not be ran from ISE but rather developed and tested in an IDE but ran from a Powershell console.
The comment from MS to use VS Code is not a great answer. I like most of the others who have posted here am in the ISE all the time. VS Code is overkill for most of what I need to do, and there are times when I'm not on my computer needing to do work. I don't want to have to install VS Code on every computer I need to use just to be able to edit or make new scripts and run them while using MFA. I also honestly don't want to have to learn all of the ins and outs of VS Code either when I'm not a programmer.
Just fix the ISE to work with MFA. I think your customers here would prefer a fix that will work on every computer that they use without having to install another program.
Thanks for the update.
This has been an annoyance when writing Azure powershell scripts as well and i wasn't aware of Visual Studio Code as being an alternative to ISE.
Response from Microsoft:
Our engineering and support teams have looked into this ISE issue, performed testing, and engaged our PowerShell dev team for guidance. From those sessions, we have the following info to share:
• Bottom-line --- ISE was not built to support cloud environments or modern auth/MFA and therefore, is not (and will not be in the future) a viable/supported tool for scripting in Office 365
• Next Steps --- The Microsoft solution alternative is the use of Visual Studio Code (note that there are 3rd party options out there that also work)
o Visual Studio Code (VS code) supports modern auth/MFA, is similar to ISE (UI is different), should have a very minimal learning curve, can be used to create and debug PS scripts, and can reuse the same scripts you have already created
o Best practice is to run the script in a PowerShell window (not VS Code or other development environment) once the script has been debugged
Rodolfo Marra commented
Same problem here. After 10-15 minutes using PowerShell ISE with MFA module imported, ISE app just freeze and I lost all information saved on variables. Need to change our scripts to run less than 10 minutes to avoid this issue. Just weird the way engineer teams work with it, or just ignore our problem.
Marci Shindel commented
Adding my company to this list of companies with this issue - since our TAM suggested we add our 2 cents to this chain as well. We have a ticket open with MS on this exact issue. Their (unacceptable) response is/was:
"“The ISE is supported in all supported versions of Windows PowerShell up to and including Windows PowerShell V5.1. The ISE, however, is in maintenance mode and no new features are likely to be added, (this includes hotfixes). Additionally, there is no support for the ISE with PowerShell v6 and beyond.” Note: right now Windows 10 1903 is running in Power Shell 5.1
However, we are using ISE 5.1 (so it should be supported) - we are connecting to GCCH. Not ready to let this go at this point, pushing back on MS to resolve. I am able to connect to EXO using plain PowerShell and the Exchange module w/o it locking up... the issues are just with the ISE to GCC, not to our old O365 environment. I can connect to JUST AzureAD/MSOL in the new environment w/o it locking up (have not tested SfB yet).
They're clearly not going to fix this after two years. Likely due to the MSOL module being deprecated in favor of the AAD module, which is not a complete replacement and doesn't provide all of the same functionality.
Same problem here...Very annoying!!! Almost two years and no response from Microsoft...Looks like we will be stuck with this problem for a looooong time