How to Remote PowerShell into Exchange Online Protection (Office 365)


Microsoft has announced the long-awaited (at least for me) possibility to use PowerShell to do Remote Connection to Exchange Online Protection.

I have previously blogged about doing Remote PowerShell session into Office 365 services, such as my post: How to Remote PowerShell into Exchange Online (Office 365).

Remote PowerShell is great administrative interface since it enables you to manage your Microsoft Exchange Online Protection (EOP) settings directly from PowerShell.

Examples of use could be:

  • Setup and configure Connectors
  • Configure Transport rules
  • Add Accepted domains


How to Connect to Exchange Online Protection

You don’t need Office 365 MS Online PowerShell module for managing your Exchange Online Protection configuration with PowerShell. Just start a PowerShell session and type in following commands:



The above command prompts you, for your Office 365 (EOP) tenant admin credentials, it is important to enter as UPN format, such as e.g.

Next, we will create a new remote PowerShell session using the following cmdlet:


Next, import the EOP cmdlets into your local PowerShell session, using the following command:


You are now connected to Exchange Online Protection (EOP) with you Office 365 (EOP) Tenant admin and can use Exchange Online Protection PowerShell cmdlets available.


For information about Exchange Online PowerShell cmdlets available see Reference to Available PowerShell Cmdlets in Exchange Online Protection on Technet.

To remove the PowerShell session again, run the following command:


Remember to remove the session, when you are done.

About Author

Peter is an Exchange specialist with over 15+ years of experience with Exchange Server and certified Microsoft Certified Master (MCM) and Microsoft Certified Solutions Master (MCSM) on Exchange Server. He has been awarded the Microsoft MVP award, every year since 2007. He is active in the Microsoft community and User Group Leader for CoLabora (a danish UC & Cloud User Group). He works as an Cloud & Infrastructure Architect and Consulent, with primary focus on Exchange, Office 365, Azure and Skype for Business.

No Comments

  1. Vandrey Trindade on

    Is giving me this error:

    New-PSSession : [] Failed to connect to remote server
    with the following error message: The WinRM client received a status code of 301 from HTTP from remote WS-Management service. For more information, go to the help topic about_Remote_Troubleshooting.
    In C:Office 365LogonEOP.ps1:42 caractere:12
    + $Session = New-PSSession -ConfigurationName Microsoft.Exchange
    -ConnectionUri ht …

    • Just tested myself and get the same error.
      Seems to be an error on the other end, with Office 365.
      Guess we’ll have to wait and see if this gets fixed. 🙂

  2. Vandrey Trindade on

    Nothing yet… is there an e-mail or forum that we could alert Microsoft about this problem?

Copyright 2005-2015 - Peter Schmidt.