Exchange online powershell

Start using PowerShell for Office 365, Exchange Online

Exchange Online, Azure Active Directory and Office 365 all work together in many ways, and to efficiently administer...

By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.

How to set up remote session to Exchange Server via PowerShell

Applies to:

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

$Cred = Get-Credential

$UserCredential = Get-Credential

A dialogue box should pop up at this stage.  Enter in your administrator username and password for exchange online

WARNING: Micro delay applied. Actual delayed: 12 msecs
WARNING: Micro delay applied. Actual delayed: 33 msecs, Enforced

Microsoft has a support article about this problem but it is not very useful.

If you continually breach this throttling policy, your account may become locked for a certain period of time. This is bad as it means you cannot perform any Exchange Online actions whilst the account is locked.

Connect to Office 365 / Exchange Online

To list the available cmdlets we can use Get-Command –Module tmp*:

image

Due to the fact that there is 290 cmdlets available when authenticating as a Office 365 global administrator the output above is truncated. Based on what RBAC-role the user is a member of, different cmdlets will be available.

A reference to the available cmdlets for administering Exchange Online is available here.

Microsoft Online Services Identity Federation Management

As an additional tip, if you’re running a hybrid configuration and using an Exchange Management Shell session to connect to Office 365 you may run into issues due to the same cmdlets being available in both your on-premises Exchange and Exchange Online. In that situation you can use Jeff’s tip of adding a prefix to the Import-PSSession command.

Проверим возможность логина в определенную базу — Test-MAPIConnectivity -Database DB1

Или в определенный почтовый ящик —

Test-MAPIConnectivity –Identity [email protected]


To use Import-PSSession, the execution policy in the current session cannot be Restricted or AllSigned, because the module that Import-PSSession creates contains unsigned script files that are prohibited by these policies.

The default PowerShell execution policy on a machine is set to Restricted. You can change the execution policy to RemoteSigned using Set-ExecutionPolicy RemoteSigned to get the above example to work. This actually happens automatically when installing the Exchange 2010 tools on a machine, but if you are importing the cmdlets on a system without the tools, you’ll need to manually set the execution policy to a less restrictive setting (if you have not already done so). See the help file about_Execution_Policies for more details. Thanks to Terence who posted about his experience with this in the comments.

Наверх