How to connect and remotely manage Microsoft 365 with PowerShell

Manage Microsoft 365 with PowerShell

System Requirements

To remotely manage Microsoft 365 with PowerShell your machine must meet the following requirements:

*Windows 7 or Windows Server 2008 should still work if you meet the rest of requirements, but since both systems have reached the end of extended support period, they are no longer officially supported.

Once you have all the components installed you are ready to connect to Exchange Online in your Microsoft 365 tenant.

Connecting to Exchange Online with PowerShell

First, you need to make sure your PowerShell console is allowed to run scripts. Run PowerShell and check your Execution policy with:

Get-Execution-Policy

If the policy is set to Restricted, run the following cmdlet:

Set-ExecutionPolicy RemoteSigned

Now, to connect to Exchange Online, run:

Connect-ExchangeOnline

Next, insert your credentials in the standard Microsoft 365 login window. And that’s it! You are now ready to run PowerShell commands.

When you are done, it’s always recommended to run:

Disconnect-ExchangeOnline

To learn about available Exchange Online cmdlets, see this Microsoft article.

See also

Tools for Microsoft 365

Recommended articles

How to connect to Microsoft 365 with Microsoft Graph PowerShell

How to connect to Microsoft 365 with Microsoft Graph PowerShell

If you want to manage your Microsoft 365 organization with Microsoft Graph PowerShell, this article is for you.
Exchange Online PowerShell V3 module: what’s that?

Exchange Online PowerShell V3 module: what’s that?

With Remote PowerShell deprecated, the Exchange Online V3 module is now essential for managing Exchange Online via PowerShell.
New-ComplianceSearch: how to use the newer version of Search-Mailbox

New-ComplianceSearch: how to use the newer version of Search-Mailbox

Microsoft retired the Search-Mailbox cmdlet – now what? Discover how to use New-ComplianceSearch instead.

Comments

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

CodeTwo sp. z o.o. sp. k. is a controller of your personal data.
See our Privacy Policy to learn more.