Connect powershell to O365/Exchange Online

 Do prerequisite on Microsoft-

https://docs.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell

Connect Session --

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session -DisableNameChecking


Disconnect Session -- Always disconnect session


Remove-PSSession $Session

No comments: