- Active Directory Administration Cookbook
- Sander Berkouwer
- 204字
- 2021-06-24 14:42:36
Using Windows PowerShell
Alternatively, replication settings for Active Directory site links can be managed using the Active Directory module for Windows PowerShell.
Use the following lines of PowerShell to modify the cost for an Active Directory site link:
Import-Module ActiveDirectory
Set-ADReplicationSiteLink -Identity DEFAULTIPSITELINK -Cost 50
Use the following lines of PowerShell to modify the replication interval for an Active Directory site link to 30 minutes:
Import-Module ActiveDirectory
Set-ADReplicationSiteLink -Identity DEFAULTIPSITELINK
-ReplicationFrequencyInMinutes 30
The -replicationschedule parameter for Set-ADReplicationSiteLink allows for the most granular management of the replication schedule for an Active Directory Site link. Just like the graphical schedule tool, it can be used to specify the days of the week for the replication schedule. But in contrast to the graphical tool, it can be used to define the available or non-available replication times per minute.
Use the following lines of PowerShell to modify the replication schedule for an Active Directory site link by only allowing replication between 8:00 A.M and 5:00 P.M:
$replicationSchedule = New-Object -TypeName System.DirectoryServices.ActiveDirectory.ActiveDirectorySchedule
$replicationSchedule.SetDailySchedule("Eight","Zero","Seventeen","Zero")
Import-Module ActiveDirectory
Set-ADReplicationSiteLink DEFAULTIPSITELINK -ReplicationSchedule $replicationSchedule