Loading...
 

Quick How to Connect to Office 365 via PowerShell

How-To create a remote PowerShell session to your Exchange Online organization

  1. Open Windows PowerShell as Administrator
  2. PS > Set-ExecutionPolicy RemoteSigned
  3. PS > $UserCredential = Get-Credential
  4. PS > $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
  5. PS > Import-PSSession $Session -DisableNameChecking
  6. PS > Connect-MsolService –Credential $UserCredential
  7. PS > Connect-AzureAD –Credential $UserCredential


"Be sure to disconnect the remote PowerShell session when you're finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command."

  1. PS > Remove-PSSession $Session

References