{"id":41535,"date":"2023-08-23T11:30:38","date_gmt":"2023-08-23T11:30:38","guid":{"rendered":"https:\/\/activedirectorypro.com\/?p=41535"},"modified":"2023-09-10T15:02:11","modified_gmt":"2023-09-10T15:02:11","slug":"force-sync-azure-ad-connect-using-powershell","status":"publish","type":"post","link":"https:\/\/activedirectorypro.com\/force-sync-azure-ad-connect-using-powershell\/","title":{"rendered":"How to Force Sync Azure AD Connect Using PowerShell"},"content":{"rendered":"\n
If you are using Azure AD Connect to sync your on-prem Active Directory to Azure you can force a sync with the following steps. <\/p>\n\n\n\n
When you install Azure AD Connect<\/a> it will include the ADSync PowerShell module. <\/p>\n\n\n\n To verify the module is loaded run the command below. <\/p>\n\n\n\n If it is not loaded use the below command (this assumes that Azure AD Connect was installed to the default path). If you run this on the machine that has Azure AD Connect installed then you most likely do not need to import the module. <\/p>\n\n\n\n You can choose to run a delta or a full sync. <\/p>\n\n\n\n To run a delta sync use this command. <\/strong><\/p>\n\n\n\n To run a full sync use this command. <\/strong><\/p>\n\n\n\n You can check the details of the sync by opening the Synchronization Service Manager. <\/p>\n\n\n\n Make sure to Run as administrator or it will give an error. <\/p>\n\n\n\n When you start the delta or full sync you can see the sync status in real time. <\/p>\n\n\n\n When it completes you can click on an entry and get more details such as adds, updates, and deletes. <\/p>\n\n\n\n You can see in the above screenshot, no changes were made. <\/p>\n\n\n\n Here are some more useful Azure Ad Connect PowerShell commands. <\/p>\n\n\n\n This command will show you what features are enabled or disabled. <\/p>\n\n\n\n You will need to first run Connect-MsolService to connect to Azure Active Directory.<\/p>\n\n\n\n This command will disable the sync schedule. This can be useful if you need to make many on-prem changes and need to temporarily disable syncing to Azure. <\/p>\n\n\n\n By default, the sync occurs every 30 minutes. To change the sync schedule use the following command. <\/p>\n\n\n\n d \u2013 days, HH \u2013 hours, mm \u2013 minutes, ss \u2013 seconds. <\/p>\n\n\n\n For example, to change the sync from 30 minutes to run every 1 hour. <\/p>\n\n\n\n If you know of any other useful Azure Sync commands please post them in the comments below. <\/p>\n","protected":false},"excerpt":{"rendered":" If you are using Azure AD Connect to sync your on-prem Active Directory to Azure you can force a sync with the following steps. Step 1. Check ADSync Module When you install Azure AD Connect it will include the ADSync PowerShell module. To verify the module is loaded run the command below. If it is … Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":41556,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1835],"tags":[],"_links":{"self":[{"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/posts\/41535"}],"collection":[{"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/comments?post=41535"}],"version-history":[{"count":3,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/posts\/41535\/revisions"}],"predecessor-version":[{"id":41562,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/posts\/41535\/revisions\/41562"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/media\/41556"}],"wp:attachment":[{"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/media?parent=41535"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/categories?post=41535"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/activedirectorypro.com\/wp-json\/wp\/v2\/tags?post=41535"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}get-module<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
Import-Module -Name \"C:\\Program Files\\Microsoft Azure AD Sync\\Bin\\ADSync\" -Verbose<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
Step 2. Run Start-ADSyncSyncCycle command<\/h2>\n\n\n\n
\n
Start-ADSyncSyncCycle -PolicyType Delta<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
Start-ADSyncSyncCycle -PolicyType Initial<\/code><\/pre>\n\n\n\n
Step 3. Check Azure AD Connect Sync Status<\/h2>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Additional Azure AD Connect PowerShell Commands<\/h2>\n\n\n\n
1. Get Azure Sync Features for a tenant<\/h3>\n\n\n\n
Get-MsolDirSyncFeatures<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
2. Get Azure AD Connect Sync Schedule<\/h3>\n\n\n\n
Get-ADSyncScheduler<\/code><\/pre>\n\n\n\n
<\/figure>\n\n\n\n
3. Disable Azure AD Connect Scheduler <\/h3>\n\n\n\n
Set-ADSyncScheduler -SyncCycleEnabled $false<\/code><\/pre>\n\n\n\n
4. Enable Azure AD Connect Scheduler<\/h3>\n\n\n\n
Set-ADSyncScheduler -SyncCycleEnabled $true<\/code><\/pre>\n\n\n\n
5. Change Azure AD Connect Sync Schedule<\/h3>\n\n\n\n
Set-ADSyncScheduler -CustomizedSyncCycleInterval d.HH:mm:ss<\/code><\/pre>\n\n\n\n
Set-ADSyncScheduler -CustomizedSyncCycleInterval 01:00:00<\/code><\/pre>\n\n\n\n