How to Enable/Disable/Verify AAD Connect via PowerShell

If you work for Service provider like me, you may see many requests from customer. Our job is not only establish hybrid connection and move the mailboxes from Exchange to Office 365, I have also had a project from Office 365 to Exchange, from Office 365 to Office 365, from Lotus Notes to Office 365.

In same cases you use PowerShell rather than Office 365 Portal.

Today I will explain how to enable/disable/verify that Directory Synchronization.

First of all, of course, you need to log in to Office 365 via PowerShell

connect-MsolService

second is to see whether AAD Connect is running or not. run the below command

“(Get-MsolCompanyInformation).DirectorySynchronizationEnabled”

PS C:\WINDOWS\system32> (Get-MsolCompanyInformation).DirectorySynchronizationEnabled
True
as you can see, in my case, it is running

If I want to stop it, I run below command

PS C:\WINDOWS\system32> Set-MsolDirSyncEnabled -EnableDirSync $false

and If I want to run it back again

PS C:\WINDOWS\system32> Set-MsolDirSyncEnabled -EnableDirSync $True

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: