Skip to content

Instantly share code, notes, and snippets.

@nyanhp
Last active February 22, 2018 09:36
Show Gist options
  • Save nyanhp/1b8fd90e2346abcb33215077a2c7acd9 to your computer and use it in GitHub Desktop.
Save nyanhp/1b8fd90e2346abcb33215077a2c7acd9 to your computer and use it in GitHub Desktop.
Making sense of AD Replication Schedules
$site = Get-ADReplicationSite -Identity Toronto
$site.ReplicationSchedule.RawSchedule # Our boolean values
foreach ( $day in 0..6) # Iterate over each day of the week, starting with Sunday
{
foreach ( $hour in 0..23) # Iterate over each hour
{
foreach ( $interval in 0..3) # Iterate over each 15-min interval
{
$replicationEnabled = $site.ReplicationSchedule.RawSchedule[$day,$hour,$interval] # This entry now contains a boolean value indicating if replication is enabled at that specific day, hour and interval
# Convert our interval to a more readable value
# We already know that it is a multiple of 15
$intervalAsTimespan = New-TimeSpan -Minutes ($interval*15)
if ( $replicationEnabled )
{
Write-Host ('{0} - {1:d2}:{2:hh\:mm}' -f [System.DayOfWeek]$day,$hour,$intervalAsTimespan) -ForegroundColor Green
}
else
{
Write-Host ('{0} - {1:d2}:{2:hh\:mm}' -f [System.DayOfWeek]$day,$hour,$intervalAsTimespan) -ForegroundColor Red
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment