I'm an admin trying to streamline my workflow. While I can pull up a list of mail flow rules and conditions directly online, I'd prefer to automate the process using PowerShell to save the info into a text or CSV file. I've got experience with various programming environments like Unix Shell Scripts, VB7, C#, SQL, and more, but PowerShell always seems to give me trouble. Currently, I'm working on a Windows 11 machine with the latest updates. I've tried running PowerShell commands with elevated permissions and even used PowerShell ISE.
The last command I attempted was to install the ExchangeOnlineManagement module, but I hit a snag with an error regarding an older version of another module being in use. Additionally, when trying to connect to Exchange Online using my admin account, I encounter some issues where it seems to kick me back to the command prompt without logging in. Anyone have insights on how to resolve this?
3 Answers
I've had similar issues with the ExchangeOnlineManagement module, but I fixed it by completely removing it and switching to an earlier version. After that, the errors disappeared, and I was able to connect without any issues!
Try connecting without the `-UserPrincipalName` parameter. Just use `Connect-ExchangeOnline` and see if that helps you log in successfully.
That warning is pretty common. It usually just means you're using an older version of the EXO module and it shouldn’t stop you from signing in. Are you getting prompted for your credentials after the command, or does it just jump back to the command line?
No, I'm just getting kicked back to the prompt as soon as I run the connect command.

Yeah, the newer module uses OAuth v2, so it should actually prompt you in a separate window for signing in, along with MFA if it's enabled. If that's not happening, something's not quite right.