Connect to Exchange Online

  1. On your local computer, open Windows PowerShell and run the following command. PowerShellCopy$UserCredential = Get-Credential In the Windows PowerShell Credential Request dialog box, type your work or school account and password, and then click OK.
  2. Run the following command: PowerShellCopy$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
    • For Office 365 operated by 21Vianet, use the ConnectionUri value:
    • For Office 365 Germany, use the ConnectionUri value:
    • For Microsoft 365 Government Community Cloud High (GCC High), use the ConnectionUri value:
    • For Microsoft 365 DoD, use the ConnectionUri value:
    • If you’re behind a proxy server, run this command first: $ProxyOptions = New-PSSessionOption -ProxyAccessType <Value>, where the ProxyAccessType value is IEConfigWinHttpConfig, or AutoDetect.Then, add the following parameter and value to the end of the $Session = … command: -SessionOption $ProxyOptions.For more information, see New-PSSessionOption.
  3. Run the following command: PowerShellCopyImport-PSSession $Session -DisableNameChecking