You can use the scripts to force Active Directory Synchronization with Microsoft 365 (Office 365) as a part of Business Rules, Custom Commands and Scheduled Tasks.
Note: Before using the scripts, make sure that the computer where Adaxes Service is installed and the computer where the DirSync / AAD Connect tool is installed allow execution of remote PowerShell commands. For details, see About Remote Requirements.
Synchronization via the DirSync Tool
This version of the script forces directory synchronization using the DirSync tool.
Parameters:
- $dirsyncServer - specifies the fully qualified domain name of your DirSync Server;
- $dirsyncmodulePath - specifies the full path to the DirSync module relative to the computer where it is installed (by default, C:\Program Files\Windows Azure Active Directory Sync\DirSyncConfigShell.psc1).
PowerShell
$dirsyncServer = "dirsync.domain.com" # TODO: modify me
$scriptBlock = {
$dirsyncModulePath = "C:\Program Files\Windows Azure Active Directory Sync\DirSyncConfigShell.psc1" # TODO: modify me
powershell -PSConsoleFile $dirsyncModulePath -Command "Start-OnlineCoexistenceSync"
}
$result = Invoke-Command -ComputerName $computerName -ScriptBlock $scriptBlock
if ($result -ne $NULL)
{
$Context.LogMessage($result, "Warning")
}
Synchronization via the AAD Connect Tool
This version of the script forces directory synchronization using the Azure Active Directory Connect (AAD Connect) tool.
Parameter:
- $dirsyncServer - specifies the fully qualified domain name of the server that hosts the AAD Connect tool.
PowerShell
$dirsyncServer = "dirsync.domain.com" # TODO: modify me
Invoke-Command -ComputerName $dirsyncServer -ErrorAction Stop -ScriptBlock {
Import-Module "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync\ADSync.psd1"
Start-ADSyncSyncCycle -PolicyType Delta
}