Use Windows Powershell ISE for Exchange when you have MFA

◇◆丶佛笑我妖孽 提交于 2020-01-05 05:33:08

问题


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


回答1:


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 Admin@Contoso.com



回答2:


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)


来源:https://stackoverflow.com/questions/44968435/use-windows-powershell-ise-for-exchange-when-you-have-mfa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!