KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

DFS Replication Backlog PowerShell Script

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Library
View previous topic :: View next topic  
Author Message
PaulNZ



Joined: 04 Apr 2017
Posts: 9

PostPosted: Wed May 03, 2017 6:24 pm    Post subject: DFS Replication Backlog PowerShell Script Reply with quote

Cobbled this together from some stuff I found online.

Name: PowerShell: Get DFS-R Backlog
Hint: Params: <Group Name> <Folder Name> <Sending Member> <Receiving Member> <Backlog Threshold>

Start cmd: powershell.exe %script% %params%
Script:

Code:
$statusAlive       = "ScriptRes:Host is alive:"
$statusDead        = "ScriptRes:No answer:"
$statusUnknown     = "ScriptRes:Unknown:"
$statusNotResolved = "ScriptRes:Unknown host:"
$statusOk          = "ScriptRes:Ok:"
$statusBad         = "ScriptRes:Bad:"
$statusBadContents = "ScriptRes:Bad contents:"

if (!$args[4]) {
  echo  $statusUnknown"Insufficient parameters provided"
  exit
}

$ReplicationGroupName = $args[0]
$ReplicatedFolderName = $args[1]
$Smem = $args[2]
$Rmem = $args[3]
$BacklogThreshold = $args[4]

$WMIQuery = "SELECT * FROM DfsrReplicatedFolderInfo WHERE ReplicationGroupName = '" + $ReplicationGroupName + "' AND ReplicatedFolderName = '" + $ReplicatedFolderName + "'"
$OutboundPartnerWMI = Get-WmiObject -computername $Smem -Namespace "root\MicrosoftDFS" -Query $WMIQuery
$InboundPartnerWMI = Get-WmiObject -computername $Rmem -Namespace "root\MicrosoftDFS" -Query $WMIQuery
$VersionVector = $InboundPartnerWMI.GetVersionVector().VersionVector
$BacklogCount = $OutboundPartnerWMI.GetOutboundBacklogFileCount($VersionVector).BacklogFileCount

if ($BacklogCount -le $BacklogThreshold)
{
   echo $statusOk$BacklogCount" Files"
}
else
{
   echo $statusBad$BacklogCount" Files"
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Library All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index