How to Remote PowerShell into Exchange Online (Office 365)

/

As described in my previous blog post last week, it is possible to use PowerShell to manage your Office 365. It is also possible to use Remote PowerShell to manage administrative tasks and Exchange settings within your Exchange Online Tenant (Office 365).

You don’t need Office 365 MS Online PowerShell module for managing your Exchange Online configuration with PowerShell. The process is very similar to how you would configure an implicit remote session to an on-premise Exchange 2010 server.

To connect to Exchange Online, just start a PowerShell session and type in following commands:

$Cred = Get-Credential

 

The above command prompts you, for your Office 365 tenant admin credentials, it is important to enter as UPN format, such as e.g. [email protected].

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

$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell -Credential $cred -Authentication Basic –AllowRedirection

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

Import-PSSession $s

 

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

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

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

Remove-PSSession $s

 

13 thoughts on “How to Remote PowerShell into Exchange Online (Office 365)”

  1. Hi Peter,

    Would I necessarily always have Exchange online enabled? I’ve just setup an Office365 trial and I can’t seem to get PS Remoting to work.

    Thanks!

Comments are closed.