问题
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