A few days ago a Microsoft PFE, that probable is using the script above, contacted me asking if I also had a version that could be used to test the latency/convergence of the SYSVOL replication. It was not that difficult to change the AD version in a way to check the SYSVOL replication. You might think I now have one script that does both AD and SYSVOL, but au contraire, there are two scripts. The one above does AD, and the one below does SYSVOL. The behavior/logic for the SYSVOL version of the script is very similar to the AD version of the script.

–

To use the script just copy the contents of the table below and put that in a script that could be called "Check-SYSVOL-Replication-Latency-Convergence.ps1", but this is of course not mandatory. In the explanations and examples I will use this name. Note that this script is not signed in any way by me, so you might need to adjust the PowerShell Execution Policy of the server where you want to execute this script. It is not possible to pass credentials through the script, so the account you are using to execute the script should have the correct permissions to create (and delete afterwards) the temporary text file in the NETLOGON folder or you should execute the script from a PowerShell console window that was started with credentials that do have the correct permissions. In addition, the server where this script is executed must be able to access every DC (RWDC and RODC) in the same AD domain through SMB (port 445). So if your network is not fully routed or you have firewalls deployed between directory servers, and those directory servers are therefore not reachable, they will be marked as not reachable. This prevents the script from trying to contact the directory servers while it is not possible. Last but not least, I just tested this script in a single AD domain AD forest with a few DCs (RWDCs and RODCs). So I do not know how well this is going to perform in an environment with a lot of DCs. If you are going to use this script, the only thing I would like to ask you is to give me feedback about it and your experiences. Thanks!

–

REMARK: This script just takes the SYSVOL into account, which is the default domain DFS namespace. However, the script could be adjusted to support ANY domain DFS namespace! The script supports both NTFRS and DFSR as the replication mechanism.

–

After the script is started, it will give you information about the DCs in the same AD domain as the server where the script is being executed on. As the default AD domain, it will use the AD domain of the server the script is being executed on.

After that, you need to specify on which RWDC from the previous AD domain, the temporary text file will be created:

Either specify the term PDC to target the RWDC that hosts the PDC FSMO role OR

Either specify the FQDN of an existing RWDC in the AD domain OR

Just press ENTER to search for an RWDC in the AD domain

If an RWDC is located right away, then that RWDC will be used

If an RODC is located right away, then that cannot be used and the RWDC that hosts the PDC FSMO role will be targeted instead

–

REMARK: In all cases the DC specified will be checked if it exists in the AD domain and if it is an RWDC and not an RODC. If it exists and it is an RWDC, the script continues and if it does not exist or if it is an RODC, the script aborts.

–

The code of the PowerShell script that does this is included below. Screen dumps are also included after the code sample.

–

I have also linked a file with the contents below to this blog post. Get it HERE.

–

!!! DISCLAIMER/REMARKS !!!:

The script is freeware, you are free to distribute it, but always refer to this website as the location where you got it

This script is furnished "as is". No warranty is expressed or implied!

Always test first in lab environment to see if it meets your needs!

Use this script at your own risk!

I do not warrant this script to be fit for any purpose, use or environment

I have tried to check everything that needed to be checked, but I do not guarantee the script does not have bugs.

I do not guarantee the script will not damage or destroy your system(s), environment or whatever.

I do not accept liability in any way if you screw up, use the script wrong or in any other way where damage is caused to your environment/systems!

If you do not accept these terms do not use the script and delete it immediately!

In this case ALL directory servers are reachable without any problems!

The script uses the AD domain the server is a part of where the script is executed. I chose for the script to find an RWDC as the target RWDC to write the temp object to

Figure 1: Using The Current AD Domain As The Target AD Domain And Letting The Script To Locate An RWDC As The Target RWDC To Write The Temp Text File To

–

The temporary text file has been created and the script is now checking it on all directory servers (DCs in AD domain)

If a DC is marked green, then the temporary text file has replicated to it and the script found the temporary text file.

If a DC is marked red, then the temporary text file has not yet replicated to it OR the DC has been marked as unreachable.

When finished it shows the start time, the end time and the duration of time before the temporary text file reached all directory servers. It also removed the temporary text file again to keep stuff clean.

This is a W2K12 AD domain that uses DFS-R as the SYSVOL replication mechanism.

Figure 2: Creating The Temp Text File In The NetLogon Share, Enumerating Through Each Directory Server To Determine The Existence Of The Temp Text File And The End Result Of The SYSVOL Replication Latency/Convergence Test

–

SINGLE AD DOMAIN AD FOREST WHERE NOT ALL DCs ARE REACHABLE:

In this case NOT ALL directory servers are reachable. The RODC is separated by a firewall from the RWDCs. The RODC can communicate with both RWDCs, The RWDCs however cannot with the RODC, except for the RPC Endpoint Mapper port and the statically configured AD replication port for change notifications. For DCs that are not reachable, the domain name and the site name of the DC might not always be specified in the table.

The script uses the AD domain the server is a part of where the script is executed. I chose for the script to find an RWDC as the target RWDC to write the temp object to. NOTE the reachability of the RODC!

Figure 3: Using The Current AD Domain As The Target AD Domain And Letting The Script To Locate An RWDC As The Target RWDC To Write The Temp Text File To

–

The temporary text file has been created and the script is now checking it on all directory servers (DCs in AD domain)

If a DC is marked green, then the temporary text file has replicated to it and the script found the temporary text file.

If a DC is marked red, then the temporary text file has not yet replicated to it OR the DC has been marked as unreachable.

When finished it shows the start time, the end time and the duration of time before the temporary text file reached all directory servers. It also removed the temporary text file again to keep stuff clean.

This is a W2K12 AD domain that uses DFS-R as the SYSVOL replication mechanism.

However, the script is not able to check that because the firewall does not allow communications to the RODC! Because the RODC is not reachable, it is marked as “Fail” in the timing.

Figure 4:Creating The Temp Text File In The NetLogon Share, Enumerating Through Each Directory Server To Determine The Existence Of The Temp Text File And The End Result Of The SYSVOL Replication Latency/Convergence Test

Joe Flicksaid

Script errors, continues and I believe goes into an infinite loop (at least in my case). The temp object is never actually created even though it says it exists on in NetLogon of one of the DCs.
—————————————————————————–
CREATING TEMP TEXT FILE IN SYSVOL/NETLOGON…: