Powershell and DfsrConfigurationFromAD - how to check all servers are updated?

Posted by user57792 on Server Fault See other posts from Server Fault or by user57792
Published on 2014-05-28T14:08:26Z Indexed on 2014/05/28 15:31 UTC
Read the original article Hit count: 239

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.

© Server Fault or respective owner

Related posts about powershell

Related posts about windows-server-2012-r2