Connect to Exchange Online PowerShell


Set-ExecutionPolicy RemoteSigned
winrm get winrm/config/client/auth

If you don’t see the value Basic = true, you need to run this command to enable basic authentication for WinRM:

winrm set winrm/config/client/auth @{Basic="true"}

If basic authentication is disabled, you’ll get this error when you try to connect:The WinRM client cannot process the request. Basic authentication
is currently disabled in the client configuration. Change the client
configuration and try the request again.

On your local computer, open Windows PowerShell and run the following command.



  • $UserCredential = Get-Credential

    In the Windows PowerShell Credential Request dialog box, type your work or school account and password, and then click OK.

  • Run the following command:
  • $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 Office 365 Government Community Cloud High (GCC High), 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 IEConfig, WinHttpConfig, or AutoDetect.

      Then, add the following parameter and value to the end of the $Session = … command: -SessionOption $ProxyOptions.

      For more information, see New-PSSessionOption.

  • Run the following command:


Import-PSSession $Session -DisableNameChecking


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.

Remove-PSSession $Session
Close Menu