Jamie_lee
Jamie_lee

Reputation: 331

Use Windows Powershell ISE for Exchange when you have MFA

I have been using Windows PowerShell ISE for some time, connecting to Azure AD,Exchange and SharePoint successfully. Recently a change in the organisation was made so we are now using MFA with exchange, I followed this https://technet.microsoft.com/en-us/library/mt775114(v=exchg.160).aspx and everything works as expected.

My question is - Is there a way to use windows PowerShell ISE to run exchange commands now?

Now it seems I am required to open the Exchange Online Remote PowerShell Module and connect and run any exchange commands through that module. I have tried using Connect-EXOPSSession cmdlet in the windows powerShell ISE but it does not understand the cmdlet

enter image description here enter image description here

Upvotes: 1

Views: 2725

Answers (2)

user11383578
user11383578

Reputation:

To connect exchange online with MFA, you need to install Microsoft's Exchange Online PowerShell Module(EXO).

You can download EXO from Exchange Admin Center.

After installing EXO, exeute below comments in Windows Powershell ISE,

$MFAExchangeModule = ((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter CreateExoPSSession.ps1 -Recurse ).FullName | Select-Object -Last 1)
#Importing Exchange MFA Module 
  . "$MFAExchangeModule" 
  Connect-EXOPSSession -UserPrincipalName [email protected]

Upvotes: 3

Adam
Adam

Reputation: 1

I come across the following for importing the Exchange Online module, allowing you to connect using New-ExoPSSession

Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}|select -First 1)

Upvotes: 0

Related Questions