This is a PowerShell script to document the replication schedule assigned to a connection object in Active Directory. The schedule attribute is a byte array with one byte for every hour of every day of a week.

The connection objects can be viewed in Active Directory Sites and Services. Intra-site replication is replication between domain controllers within a site. Intra-site connection objects are in the "NTDS Settings" container for each server in the Configuration partition. For example, the distinguished name could be similar to:

cn=<guid>,cn=NTDS Settings,cn=MyServer,cn=Servers,cn=MySite,cn=Sites,cn=Configuration,dc=Domain,dc=com

where <guid> is a GUID. Intra-site connection objects created by an administrator will have a name selected by the administrator.

Inter-site replication is replication between sites. The replication schedule is specified in a Site Link object that connects two sites. The Site Link objects will have distinguished names similar to:

cn=SiteA-SiteB,cn=IP,cn=Inter-Site Transports,cn=Sites,cn=Configuration,dc=Domain,dc=com

You can view the replication schedule for any connection object in AD Sites and Services. Objects with class NTDS-Connection, NTDS-Site-Settings, or Site-Link will have the schedule attribute.

The schedule attribute is data type OctetString, which is a byte array. The schedule attribute of connection objects has 188 bytes. The first 20 bytes are a header that doesn't change. The remaining 168 bytes specify replication for each of the 24 hours in a day, for each of the 7 days in a week.

The GetSchedule.ps1 script described here supports the parameters in the following table:

Parameter Abbreviation Description
-Site -s Name (RDN) of the Site
-ToServer -t Name (RDN) of the Destination Server
-FromServer -fro Name (RDN) of the Source Server
-Name -n Name (RDN) of the inter-site connection object
-DN -d Distinguished Name of the connection object
-Black -b Switch to not use Write-Host
-CSV -c Switch to output in CSV format
-Value -v Switch to output decimal values
-Frequency -fre Switch to output replication frequency per hour
-Key -k Switch to display what values mean
-Help -h Switch to display help

The first one or more letters of each parameter above can be used as an abbreviation, except that at least 3 letters are required to distinguish between -FromServer and -Frequency.

To document an intra-site connection object schedule, use the -Site parameter to specify the site name, the -ToServer parameter to specify the NetBIOS name of the destination server, and the -FromServer parameter to specify the source server. Alternatively, you can use the -DN parameter to specify the distinguished name of the connection object. The values for -Site, -ToServer, and -FromServer can be specified in order without the parameter names. For an inter-site connection object, use the -Name parameter to specify the name of the object, or the -DN parameter to specify the distinguished name.

You can specify the switch -Value to have the schedule displayed as decimal values. Specify the switch -Frequency to have the schedule displayed as the number of times each hour that replication is scheduled. If neither -Value nor -Frequency is specified, the default output indicates in which 15 minute interval of each hour replication is scheduled. For example, the string "nYnn" means replication is scheduled during the second 15 minute interval in the hour, from 15 to 29 minutes after the hour. Run GetSchedule.ps1 with the -Key parameter to output a table that documents the meaning of all possible values for each byte of the schedule attribute, whether in decimal, hexadecimal, or binary.

Use the following statement to document the intra-site replication schedule from ServerC to ServerA in site Site-1. Because the -CSV parameter is used, the schedule will be documented in comma delimited decimal values for each hour. The output is redirected to the file Site-1.csv in the current directory.

.\GetSchedule.ps1 Site-1 ServerA ServerC -CSV > .\Site-1.csv

This results in output similar to the following (in file Site-1.csv):

0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
0,1,10,11,0,1,5,15,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
0,2,10,11,0,12,13,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1

The first line is a header, specifying the hours in a day, in local time. Next is one line for each day of a week, Sunday through Saturday. The decimal values have the meanings documented in the table displayed when you use the -Key parameter, as shown later.

The following example documents the inter-site replication schedule between Site-A and Site-B. The output shows the number of replications each hour and is redirected to file SiteA-SiteB.csv

.\GetSchedule.ps1 -N SiteA-SiteB -freq -CSV > .\SiteA-SiteB.csv

The output will be very similar to the example above, except the numbers for each hour will be the number of times replication is scheduled. The numbers can be 0, 1, 2, 3, or 4.

To output the table of possible values for each hour in the schedule use the -Key parameter:

.\GetSchedule.ps1 -k

which results in the following table:

Key to values in the schedule array, one value for each hour of each day
of the week. n = no replication, Y = replication scheduled.
For example, "nnYn" (decimal 4) means replication is scheduled during
the third 15 minute interval after the hour.
                                --- Minutes after hour ---
Decimal  Hex  Binary  Syncs/Hr  00-14  15-29  30-44  45-59 Display
  0      0     0000        0      n      n      n      n     nnnn
  1      1     0001        1      Y      n      n      n     Ynnn
  2      2     0010        1      n      Y      n      n     nYnn
  3      3     0011        2      Y      Y      n      n     YYnn
  4      4     0100        1      n      n      Y      n     nnYn
  5      5     0101        2      Y      n      Y      n     YnYn
  6      6     0110        2      n      Y      Y      n     nYYn
  7      7     0111        3      Y      Y      Y      n     YYYn
  8      8     1000        1      n      n      n      Y     nnnY
  9      9     1001        2      Y      n      n      Y     YnnY
 10      A     1010        2      n      Y      n      Y     nYnY
 11      B     1011        3      Y      Y      n      Y     YYnY
 12      C     1100        2      n      n      Y      Y     nnYY
 13      D     1101        3      Y      n      Y      Y     YnYY
 14      E     1110        3      n      Y      Y      Y     nYYY
 15      F     1111        4      Y      Y      Y      Y     YYYY
Note:
The first bit in each binary value corresponds to the first 15 minute
interval, from 0 to 14 minutes after the hour. The first bit is the
far right hand bit of the binary representation of the value.

GetSchedule.txt <<-- Click here to view or download the program