SHARE
TWEET

DFSR Backlog

a guest Jul 9th, 2014 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set wshShell = WScript.CreateObject( "WScript.Shell" )
  2. strComputer = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
  3.  
  4. bConnectForeign = False
  5. Wscript.echo("<<<dfs_backlog:sep(59)>>>")
  6.  
  7.     Set oWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftDFS")
  8.     Set colRGroups = oWMIService.ExecQuery("SELECT * FROM DfsrReplicationGroupConfig")
  9.     For Each oGroup in colRGroups
  10.         'wscript.echo "Replication Group: " & oGroup.ReplicationGroupName
  11.        Set colRGFolders = oWMIService.ExecQuery("SELECT * FROM DfsrReplicatedFolderConfig WHERE ReplicationGroupGUID='" & oGroup.ReplicationGroupGUID & "'")
  12.         For Each oFolder in colRGFolders
  13.             'wscript.echo "  Folder: " & oFolder.ReplicatedFolderName
  14.            Set colRGConnections = oWMIService.ExecQuery("SELECT * FROM DfsrConnectionConfig WHERE ReplicationGroupGUID='" & oGroup.ReplicationGroupGUID & "'")
  15.             For Each oConnection in colRGConnections
  16.                 If oConnection.Enabled = True Then
  17.                     If oConnection.Inbound = True Then
  18.                         if bConnectForeign then
  19.                             numBackLog = getBackLogCount(oConnection.PartnerName, oConnection.ConnectionGUID, oFolder.ReplicatedFolderGuid)
  20.                         else
  21.                             numBackLog = getBackLogCount(strComputer, oConnection.ConnectionGUID, oFolder.ReplicatedFolderGuid)
  22.                         end if
  23.                         Wscript.echo oFolder.ReplicatedFolderName & " ( from " & oConnection.PartnerName & ");" & numBackLog
  24.                     Else
  25.                         numBackLog = getBackLogCount(strComputer, oConnection.ConnectionGUID, oFolder.ReplicatedFolderGuid)
  26.                         Wscript.echo oFolder.ReplicatedFolderName & " ( to " & oConnection.PartnerName & ");" & numBackLog
  27.                     End If
  28.                 End If
  29.             Next
  30.         Next
  31.     Next
  32.  
  33. Function getBackLogCount(strComputer, ConnectionGUID, FolderGuid)
  34.     Set oWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftDFS")
  35.     Set oDfsIUI = oWMIService.ExecQuery("SELECT * FROM DfsrIdUpdateInfo WHERE ConnectionGuid = '" & ConnectionGUID & "' AND ReplicatedFolderGuid ='" & FolderGuid & "'")
  36.     numBacklog=0
  37.     for each eDfsIUI in oDfsIUI
  38.         numBackLog=numBackLog+1
  39.     next
  40.     getBackLogCount = numBackLog
  41. End Function
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top