Powershell and DfsrConfigurationFromAD - how to check all servers are updated?
- by user57792
I have two Win2012R2 servers (SERVER1 and SERVER2) that uses DFS Replication for keeping a couple of folders synchronized.
Using the following Powershell-script that i run on SERVER1 I disconnect it from the group:
Set-DfsrConnection -GroupName "Group1" -SourceComputerName "SERVER1" -DestinationComputerName "SERVER2" -DisableConnection $True;
And to update both the servers with the configuration I run the command:
Update-DfsrConfigurationFromAD -ComputerName "SERVER1","SERVER2"
Now the question is, how can check on SERVER1 that SERVER2 has gotten the updated information from the AD so that I can be sure that the connection has been disabled? Usually it takes around 10-30 seconds after the Update-DfsrConfigurationFromAD command has been run before the DFS Management on SERVER2 gets updated but I need some kind of a "check and sleep loop" in my code.
I've tried checking event logs and using Invoke-Command {Get-DfsrConnection} from PM-SERVER01 but nothing seems to work.