<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Powershell and DFSR</title>
	<atom:link href="http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/feed/" rel="self" type="application/rss+xml" />
	<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/</link>
	<description>Mindless ramblings of a geek...</description>
	<lastBuildDate>Tue, 16 Aug 2011 20:15:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: Mark A. Weaver</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-2/#comment-559</link>
		<dc:creator>Mark A. Weaver</dc:creator>
		<pubDate>Mon, 18 Apr 2011 23:39:01 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-559</guid>
		<description>I will have to take a look and see why that isn&#039;t being handled appropriately.  Do you have an example of what the DFSRDIAG command returns if you run it as you describe?
I think I may have found the issue. It is because I set a &quot;default&quot; value for $BacklogFileCount = 0.  

I am not in front of my lab right now, but you could try initializing it to $NULL:
                $Backlog = Invoke-Expression -Command $BLCommand
                $BackLogFilecount = $NULL
	foreach ($item in $Backlog)
                  ...
... 
    and see if that accurate reports the information.

  Please let me know if that helps.
    -- Mark</description>
		<content:encoded><![CDATA[<p>I will have to take a look and see why that isn&#8217;t being handled appropriately.  Do you have an example of what the DFSRDIAG command returns if you run it as you describe?<br />
I think I may have found the issue. It is because I set a &#8220;default&#8221; value for $BacklogFileCount = 0.  </p>
<p>I am not in front of my lab right now, but you could try initializing it to $NULL:<br />
                $Backlog = Invoke-Expression -Command $BLCommand<br />
                $BackLogFilecount = $NULL<br />
	foreach ($item in $Backlog)<br />
                  &#8230;<br />
&#8230;<br />
    and see if that accurate reports the information.</p>
<p>  Please let me know if that helps.<br />
    &#8212; Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Macallister</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-2/#comment-558</link>
		<dc:creator>Jason Macallister</dc:creator>
		<pubDate>Mon, 18 Apr 2011 18:23:09 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-558</guid>
		<description>There is a problem with this script.  It can positively report that the backlog is zero on replication pairs where there is an issue with DFS replication.  For instance the DFS service is down on the sender.  If you were to run the DFSRDIAG Backlog command from the PowerShell you would get a different error rather than an actual backlog number.  This script reports that as a backlog of zero.</description>
		<content:encoded><![CDATA[<p>There is a problem with this script.  It can positively report that the backlog is zero on replication pairs where there is an issue with DFS replication.  For instance the DFS service is down on the sender.  If you were to run the DFSRDIAG Backlog command from the PowerShell you would get a different error rather than an actual backlog number.  This script reports that as a backlog of zero.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark A. Weaver</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-557</link>
		<dc:creator>Mark A. Weaver</dc:creator>
		<pubDate>Thu, 24 Mar 2011 01:00:02 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-557</guid>
		<description>&lt;a href=&quot;#comment-556&quot; rel=&quot;nofollow&quot;&gt;@Tom  &lt;/a&gt; 
I have typically done this as a scheduled task that run once a week.
I then had my monitoring tool would pick and alert on the appropriate event log entries.
Glad you were able to get this working!!
Please let me know if you have any other questions or problems.
  Thanks,
    -- Mark</description>
		<content:encoded><![CDATA[<p><a href="#comment-556" rel="nofollow">@Tom  </a><br />
I have typically done this as a scheduled task that run once a week.<br />
I then had my monitoring tool would pick and alert on the appropriate event log entries.<br />
Glad you were able to get this working!!<br />
Please let me know if you have any other questions or problems.<br />
  Thanks,<br />
    &#8212; Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-556</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Wed, 23 Mar 2011 14:33:44 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-556</guid>
		<description>that did it Mark, thanks a million!  the problem is my lack of full understanding of DFS-R ;-), we have win2k8 R2 domain based DFS and i thought we should run all dfs commands from a DC.  however the members were file servers so this makes sense now.  its working great now, and thanks for sharing this will help tremendously!

How do most use this script, do they setup in the task scheduler or something different?</description>
		<content:encoded><![CDATA[<p>that did it Mark, thanks a million!  the problem is my lack of full understanding of DFS-R <img src='http://vmweaver.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> , we have win2k8 R2 domain based DFS and i thought we should run all dfs commands from a DC.  however the members were file servers so this makes sense now.  its working great now, and thanks for sharing this will help tremendously!</p>
<p>How do most use this script, do they setup in the task scheduler or something different?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark A. Weaver</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-555</link>
		<dc:creator>Mark A. Weaver</dc:creator>
		<pubDate>Wed, 23 Mar 2011 01:02:12 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-555</guid>
		<description>Thanks for replying. 
First thing I notice is the piece about: 

&quot;The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.&quot;

This script actually uses the dfsrdiag.exe application to determine backlog.

So, it looks like you are running this on a Domain Controller since it is detecting the SYSVOL shares.  What troubles me is that:
 1. dfsrdiag.exe is not in the path (or even on the system)
 2. the DFSR groups you created aren&#039;t showing up when querying the WMI provider.  

Can you verify that the DFS Replication feature is enabled on the Domain Controller (Under File Service Role)?
When the DFS Replication feature is installed, the dfsrdiag.exe should show up in the path.
Also, make sure that the Replication Group configuration has the domain controller as one of the members. 
If not, then should log into one of the members of the replication group, make sure you can run dfsrdiag.exe from a command line, and then try the script.

Let me know what you find out. I would love to assist further, if possible.

Thanks, 
 -- Mark</description>
		<content:encoded><![CDATA[<p>Thanks for replying.<br />
First thing I notice is the piece about: </p>
<p>&#8220;The term &#8216;dfsrdiag&#8217; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.&#8221;</p>
<p>This script actually uses the dfsrdiag.exe application to determine backlog.</p>
<p>So, it looks like you are running this on a Domain Controller since it is detecting the SYSVOL shares.  What troubles me is that:<br />
 1. dfsrdiag.exe is not in the path (or even on the system)<br />
 2. the DFSR groups you created aren&#8217;t showing up when querying the WMI provider.  </p>
<p>Can you verify that the DFS Replication feature is enabled on the Domain Controller (Under File Service Role)?<br />
When the DFS Replication feature is installed, the dfsrdiag.exe should show up in the path.<br />
Also, make sure that the Replication Group configuration has the domain controller as one of the members.<br />
If not, then should log into one of the members of the replication group, make sure you can run dfsrdiag.exe from a command line, and then try the script.</p>
<p>Let me know what you find out. I would love to assist further, if possible.</p>
<p>Thanks,<br />
 &#8212; Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-554</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Tue, 22 Mar 2011 21:23:38 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-554</guid>
		<description>&lt;a href=&quot;#comment-552&quot; rel=&quot;nofollow&quot;&gt;@Mark A. Weaver &lt;/a&gt; 

Here is the output and what happens.

PS C:\Windows\system32&gt; ######################################################################
PS C:\Windows\system32&gt; ######################################################################
PS C:\Windows\system32&gt; ## Main
PS C:\Windows\system32&gt; ## Errors written:
PS C:\Windows\system32&gt; ##   Log File: Application
PS C:\Windows\system32&gt; ##   Source: Check-DFSR Script
PS C:\Windows\system32&gt; ##   ID: 9500 - Lists fully replicated replication folders
PS C:\Windows\system32&gt; ##   ID: 9501 - Lists replication folders with less than the $BacklogErrorLevel files waiting
PS C:\Windows\system32&gt; ##   ID: 9502 - Lists replication folders with more than the $BacklogErrorLevel files waiting
PS C:\Windows\system32&gt; ##   ID: 9503 - If a connection is not pingable, this event is written.
PS C:\Windows\system32&gt;
PS C:\Windows\system32&gt; $BacklogErrorLevel = 10
PS C:\Windows\system32&gt;
PS C:\Windows\system32&gt; $ComputerName = $env:ComputerName
PS C:\Windows\system32&gt; ## Query DFSR groups from the local MicrosftDFS WMI namespace.
PS C:\Windows\system32&gt; $DFSRGroupWMIQuery = &quot;SELECT * FROM DfsrReplicationGroupConfig&quot;
PS C:\Windows\system32&gt; $RGroups = Get-WmiObject -Namespace &quot;root\MicrosoftDFS&quot; -Query $DFSRGroupWMIQuery
PS C:\Windows\system32&gt;
PS C:\Windows\system32&gt;
PS C:\Windows\system32&gt; ## Setup my variables
PS C:\Windows\system32&gt; $ping = New-Object System.Net.NetworkInformation.Ping
PS C:\Windows\system32&gt; $SuccessAudit = $Null
PS C:\Windows\system32&gt; $WarningAudit = $Null
PS C:\Windows\system32&gt; $ErrorAudit = $Null
PS C:\Windows\system32&gt; $EventSource = &quot;Check-DFSR Script&quot;
PS C:\Windows\system32&gt; $SuccessEventID = 9500
PS C:\Windows\system32&gt; $WarningEventID = 9501
PS C:\Windows\system32&gt; $ErrorEventID = 9502
PS C:\Windows\system32&gt; $NoPingEventID = 9503
PS C:\Windows\system32&gt;
PS C:\Windows\system32&gt; foreach ($Group in $RGroups)
&gt;&gt; {
&gt;&gt;     ## Cycle through all Replication groups found
&gt;&gt;     $DFSRGFoldersWMIQuery = &quot;SELECT * FROM DfsrReplicatedFolderConfig WHERE ReplicationGroupGUID=&#039;&quot; + $Group.Replicat
ionGroupGUID + &quot;&#039;&quot;
&gt;&gt;     $RGFolders = Get-WmiObject -Namespace &quot;root\MicrosoftDFS&quot; -Query $DFSRGFoldersWMIQuery
&gt;&gt;
&gt;&gt;     ## Grab all connections associated with a Replication Group
&gt;&gt;     $DFSRConnectionWMIQuery = &quot;SELECT * FROM DfsrConnectionConfig WHERE ReplicationGroupGUID=&#039;&quot; + $Group.ReplicationG
roupGUID + &quot;&#039;&quot;
&gt;&gt;     $RGConnections = Get-WmiObject -Namespace &quot;root\MicrosoftDFS&quot; -Query $DFSRConnectionWMIQuery
&gt;&gt;     foreach ($Connection in $RGConnections)
&gt;&gt;     {
&gt;&gt;
&gt;&gt;         $ConnectionName = $Connection.PartnerName.Trim()
&gt;&gt;         $IsInBound = $Connection.Inbound
&gt;&gt;         $IsEnabled = $Connection.Enabled
&gt;&gt;
&gt;&gt;         ## Do not attempt to look at connections that are Disabled
&gt;&gt;         if ($IsEnabled -eq $True)
&gt;&gt;         {
&gt;&gt;             ## If the connection is not ping-able, do not attempt to query it for Backlog info
&gt;&gt;             $Reply = $ping.send(&quot;$ConnectionName&quot;)
&gt;&gt;             if ($reply.Status -eq &quot;Success&quot;)
&gt;&gt;             {
&gt;&gt;
&gt;&gt;
&gt;&gt;                 ## Cycle through the Replication Folders that are part of the replication group and run DFSRDIAG tool
 to determine the backlog on the connection partners.
&gt;&gt;                 foreach ($Folder in $RGFolders)
&gt;&gt;                 {
&gt;&gt;                     $RGName = $Group.ReplicationGroupName
&gt;&gt;                     $RFName = $Folder.ReplicatedFolderName
&gt;&gt;
&gt;&gt;                     ## Determine if current connect is an inbound connection or not, set send/receive members accordi
ngly
&gt;&gt;                     if ($IsInBound -eq $True)
&gt;&gt;                     {
&gt;&gt;                         $SendingMember = $ConnectionName
&gt;&gt;                         $ReceivingMember = $ComputerName
&gt;&gt;                     }
&gt;&gt;                     else
&gt;&gt;                     {
&gt;&gt;                         $SendingMember = $ComputerName
&gt;&gt;                         $ReceivingMember = $ConnectionName
&gt;&gt;                     }
&gt;&gt;                        $Out = $RGName + &quot;:&quot; + $RFName +  &quot; - S:&quot;+$SendingMember + &quot; R:&quot; + $ReceivingMember
&gt;&gt;                        Write-Host $Out
&gt;&gt;                         ## Execute the dfsrdiag command and get results back in the $Backlog variable
&gt;&gt;                         $BLCommand = &quot;dfsrdiag Backlog /RGName:&#039;&quot; + $RGName + &quot;&#039; /RFName:&#039;&quot; + $RFName + &quot;&#039; /SendingMe
mber:&quot; + $SendingMember + &quot; /ReceivingMember:&quot; + $ReceivingMember
&gt;&gt;                         $Backlog = Invoke-Expression -Command $BLCommand
&gt;&gt;
&gt;&gt;                         $BackLogFilecount = 0
&gt;&gt;                         foreach ($item in $Backlog)
&gt;&gt;                         {
&gt;&gt;                             if ($item -ilike &quot;*Backlog File count*&quot;)
&gt;&gt;                             {
&gt;&gt;                                 $BacklogFileCount = [int]$Item.Split(&quot;:&quot;)[1].Trim()
&gt;&gt;                             }
&gt;&gt;
&gt;&gt;                         }
&gt;&gt;
&gt;&gt;
&gt;&gt;                         if ($BacklogFileCount -eq 0)
&gt;&gt;                         {
&gt;&gt;                             #Update Success Audit
&gt;&gt;                             $SuccessAudit += $RGName + &quot;:&quot; + $RFName + &quot; is in sync with 0 files in the backlog from
&quot;+ $SendingMember + &quot; to &quot; + $ReceivingMember +&quot;.`n&quot;
&gt;&gt;
&gt;&gt;                         }
&gt;&gt;                         elseif ($BacklogFilecount -lt $BacklogErrorLevel)
&gt;&gt;                         {
&gt;&gt;                             #Update Warning Audit
&gt;&gt;                             $WarningAudit += $RGName + &quot;:&quot; + $RFName + &quot; has &quot; + $BacklogFileCount + &quot; files in the b
acklog from &quot; + $SendingMember + &quot; to &quot; + $ReceivingMember + &quot;.`n&quot;
&gt;&gt;                         }
&gt;&gt;                         else
&gt;&gt;                         {
&gt;&gt;                             #Update Error Audit
&gt;&gt;                             $ErrorAudit += $RGName + &quot;:&quot; + $RFName + &quot; has &quot; + $BacklogFilecount + &quot; files in the bac
klog from &quot; + $SendingMember + &quot; to &quot; + $ReceivingMember + &quot;.`n&quot;
&gt;&gt;                         }
&gt;&gt;                         #Write-Host + $Folder.ReplicatedFolderName &quot;- &quot; $BackLogFilecount -foregroundcolor $FGColor
&gt;&gt;                     }
&gt;&gt;                 }
&gt;&gt;                 else
&gt;&gt;                 {
&gt;&gt;                 Write-Host $ConnectionName &quot;is not pingable&quot;
&gt;&gt;                 $NoPingMessage = &quot;Server &quot;&quot;&quot; + $ConnectionName + &quot;&quot;&quot; could not be reached.`nPlease verify it is on th
e network and pingable.&quot;
&gt;&gt;                 Write-Event $EventSource $NoPingEventID &quot;Warning&quot; $NoPingMessage &quot;Application&quot;
&gt;&gt;                 }
&gt;&gt;             }
&gt;&gt;
&gt;&gt;     }
&gt;&gt;
&gt;&gt; }
&gt;&gt; ## Write my events to the local Application log.
&gt;&gt;
Domain System Volume:SYSVOL Share - S:MYDC05 R:MYDC01
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC05 /ReceivingMember:M
VDC01
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC04 R:MYDC01
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC04 /ReceivingMember:M
VDC01
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC02 R:MYDC01
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC02 /ReceivingMember:M
VDC01
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC03 R:MYDC01
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC03 /ReceivingMember:M
VDC01
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC01 R:MYDC02
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC01 /ReceivingMember:MY 
DC02
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC01 R:MYDC03
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC01 /ReceivingMember:J
VDC02
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC01 R:MYDC04
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC01 /ReceivingMember:E
VDC01
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Domain System Volume:SYSVOL Share - S:MYDC01 R:MYDC05
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp
elling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:9
+ dfsrdiag &lt;&lt;&lt; if ($SuccessAudit -ne $Null)
&gt;&gt; {
&gt;&gt;     Write-Event $EventSource $SuccessEventID &quot;Information&quot; $SuccessAudit &quot;Application&quot;
&gt;&gt; }
&gt;&gt;
PS C:\Windows\system32&gt; if ($WarningAudit -ne $Null)
&gt;&gt; {
&gt;&gt;     Write-Event $EventSource $WarningEventID &quot;Warning&quot; $WarningAudit &quot;Application&quot;
&gt;&gt; }
&gt;&gt;
PS C:\Windows\system32&gt; if ($ErrorAudit -ne $Null)
&gt;&gt; {
&gt;&gt;     Write-Event $EventSource $ErrorEventID &quot;Error&quot; $ErrorAudit &quot;Application&quot;
&gt;&gt;
&gt;&gt;</description>
		<content:encoded><![CDATA[<p><a href="#comment-552" rel="nofollow">@Mark A. Weaver </a> </p>
<p>Here is the output and what happens.</p>
<p>PS C:\Windows\system32&gt; ######################################################################<br />
PS C:\Windows\system32&gt; ######################################################################<br />
PS C:\Windows\system32&gt; ## Main<br />
PS C:\Windows\system32&gt; ## Errors written:<br />
PS C:\Windows\system32&gt; ##   Log File: Application<br />
PS C:\Windows\system32&gt; ##   Source: Check-DFSR Script<br />
PS C:\Windows\system32&gt; ##   ID: 9500 &#8211; Lists fully replicated replication folders<br />
PS C:\Windows\system32&gt; ##   ID: 9501 &#8211; Lists replication folders with less than the $BacklogErrorLevel files waiting<br />
PS C:\Windows\system32&gt; ##   ID: 9502 &#8211; Lists replication folders with more than the $BacklogErrorLevel files waiting<br />
PS C:\Windows\system32&gt; ##   ID: 9503 &#8211; If a connection is not pingable, this event is written.<br />
PS C:\Windows\system32&gt;<br />
PS C:\Windows\system32&gt; $BacklogErrorLevel = 10<br />
PS C:\Windows\system32&gt;<br />
PS C:\Windows\system32&gt; $ComputerName = $env:ComputerName<br />
PS C:\Windows\system32&gt; ## Query DFSR groups from the local MicrosftDFS WMI namespace.<br />
PS C:\Windows\system32&gt; $DFSRGroupWMIQuery = &#8220;SELECT * FROM DfsrReplicationGroupConfig&#8221;<br />
PS C:\Windows\system32&gt; $RGroups = Get-WmiObject -Namespace &#8220;root\MicrosoftDFS&#8221; -Query $DFSRGroupWMIQuery<br />
PS C:\Windows\system32&gt;<br />
PS C:\Windows\system32&gt;<br />
PS C:\Windows\system32&gt; ## Setup my variables<br />
PS C:\Windows\system32&gt; $ping = New-Object System.Net.NetworkInformation.Ping<br />
PS C:\Windows\system32&gt; $SuccessAudit = $Null<br />
PS C:\Windows\system32&gt; $WarningAudit = $Null<br />
PS C:\Windows\system32&gt; $ErrorAudit = $Null<br />
PS C:\Windows\system32&gt; $EventSource = &#8220;Check-DFSR Script&#8221;<br />
PS C:\Windows\system32&gt; $SuccessEventID = 9500<br />
PS C:\Windows\system32&gt; $WarningEventID = 9501<br />
PS C:\Windows\system32&gt; $ErrorEventID = 9502<br />
PS C:\Windows\system32&gt; $NoPingEventID = 9503<br />
PS C:\Windows\system32&gt;<br />
PS C:\Windows\system32&gt; foreach ($Group in $RGroups)<br />
&gt;&gt; {<br />
&gt;&gt;     ## Cycle through all Replication groups found<br />
&gt;&gt;     $DFSRGFoldersWMIQuery = &#8220;SELECT * FROM DfsrReplicatedFolderConfig WHERE ReplicationGroupGUID=&#8217;&#8221; + $Group.Replicat<br />
ionGroupGUID + &#8220;&#8216;&#8221;<br />
&gt;&gt;     $RGFolders = Get-WmiObject -Namespace &#8220;root\MicrosoftDFS&#8221; -Query $DFSRGFoldersWMIQuery<br />
&gt;&gt;<br />
&gt;&gt;     ## Grab all connections associated with a Replication Group<br />
&gt;&gt;     $DFSRConnectionWMIQuery = &#8220;SELECT * FROM DfsrConnectionConfig WHERE ReplicationGroupGUID=&#8217;&#8221; + $Group.ReplicationG<br />
roupGUID + &#8220;&#8216;&#8221;<br />
&gt;&gt;     $RGConnections = Get-WmiObject -Namespace &#8220;root\MicrosoftDFS&#8221; -Query $DFSRConnectionWMIQuery<br />
&gt;&gt;     foreach ($Connection in $RGConnections)<br />
&gt;&gt;     {<br />
&gt;&gt;<br />
&gt;&gt;         $ConnectionName = $Connection.PartnerName.Trim()<br />
&gt;&gt;         $IsInBound = $Connection.Inbound<br />
&gt;&gt;         $IsEnabled = $Connection.Enabled<br />
&gt;&gt;<br />
&gt;&gt;         ## Do not attempt to look at connections that are Disabled<br />
&gt;&gt;         if ($IsEnabled -eq $True)<br />
&gt;&gt;         {<br />
&gt;&gt;             ## If the connection is not ping-able, do not attempt to query it for Backlog info<br />
&gt;&gt;             $Reply = $ping.send(&#8220;$ConnectionName&#8221;)<br />
&gt;&gt;             if ($reply.Status -eq &#8220;Success&#8221;)<br />
&gt;&gt;             {<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;                 ## Cycle through the Replication Folders that are part of the replication group and run DFSRDIAG tool<br />
 to determine the backlog on the connection partners.<br />
&gt;&gt;                 foreach ($Folder in $RGFolders)<br />
&gt;&gt;                 {<br />
&gt;&gt;                     $RGName = $Group.ReplicationGroupName<br />
&gt;&gt;                     $RFName = $Folder.ReplicatedFolderName<br />
&gt;&gt;<br />
&gt;&gt;                     ## Determine if current connect is an inbound connection or not, set send/receive members accordi<br />
ngly<br />
&gt;&gt;                     if ($IsInBound -eq $True)<br />
&gt;&gt;                     {<br />
&gt;&gt;                         $SendingMember = $ConnectionName<br />
&gt;&gt;                         $ReceivingMember = $ComputerName<br />
&gt;&gt;                     }<br />
&gt;&gt;                     else<br />
&gt;&gt;                     {<br />
&gt;&gt;                         $SendingMember = $ComputerName<br />
&gt;&gt;                         $ReceivingMember = $ConnectionName<br />
&gt;&gt;                     }<br />
&gt;&gt;                        $Out = $RGName + &#8220;:&#8221; + $RFName +  &#8221; &#8211; S:&#8221;+$SendingMember + &#8221; R:&#8221; + $ReceivingMember<br />
&gt;&gt;                        Write-Host $Out<br />
&gt;&gt;                         ## Execute the dfsrdiag command and get results back in the $Backlog variable<br />
&gt;&gt;                         $BLCommand = &#8220;dfsrdiag Backlog /RGName:&#8217;&#8221; + $RGName + &#8220;&#8216; /RFName:&#8217;&#8221; + $RFName + &#8220;&#8216; /SendingMe<br />
mber:&#8221; + $SendingMember + &#8221; /ReceivingMember:&#8221; + $ReceivingMember<br />
&gt;&gt;                         $Backlog = Invoke-Expression -Command $BLCommand<br />
&gt;&gt;<br />
&gt;&gt;                         $BackLogFilecount = 0<br />
&gt;&gt;                         foreach ($item in $Backlog)<br />
&gt;&gt;                         {<br />
&gt;&gt;                             if ($item -ilike &#8220;*Backlog File count*&#8221;)<br />
&gt;&gt;                             {<br />
&gt;&gt;                                 $BacklogFileCount = [int]$Item.Split(&#8220;:&#8221;)[1].Trim()<br />
&gt;&gt;                             }<br />
&gt;&gt;<br />
&gt;&gt;                         }<br />
&gt;&gt;<br />
&gt;&gt;<br />
&gt;&gt;                         if ($BacklogFileCount -eq 0)<br />
&gt;&gt;                         {<br />
&gt;&gt;                             #Update Success Audit<br />
&gt;&gt;                             $SuccessAudit += $RGName + &#8220;:&#8221; + $RFName + &#8221; is in sync with 0 files in the backlog from<br />
&#8220;+ $SendingMember + &#8221; to &#8221; + $ReceivingMember +&#8221;.`n&#8221;<br />
&gt;&gt;<br />
&gt;&gt;                         }<br />
&gt;&gt;                         elseif ($BacklogFilecount -lt $BacklogErrorLevel)<br />
&gt;&gt;                         {<br />
&gt;&gt;                             #Update Warning Audit<br />
&gt;&gt;                             $WarningAudit += $RGName + &#8220;:&#8221; + $RFName + &#8221; has &#8221; + $BacklogFileCount + &#8221; files in the b<br />
acklog from &#8221; + $SendingMember + &#8221; to &#8221; + $ReceivingMember + &#8220;.`n&#8221;<br />
&gt;&gt;                         }<br />
&gt;&gt;                         else<br />
&gt;&gt;                         {<br />
&gt;&gt;                             #Update Error Audit<br />
&gt;&gt;                             $ErrorAudit += $RGName + &#8220;:&#8221; + $RFName + &#8221; has &#8221; + $BacklogFilecount + &#8221; files in the bac<br />
klog from &#8221; + $SendingMember + &#8221; to &#8221; + $ReceivingMember + &#8220;.`n&#8221;<br />
&gt;&gt;                         }<br />
&gt;&gt;                         #Write-Host + $Folder.ReplicatedFolderName &#8220;- &#8221; $BackLogFilecount -foregroundcolor $FGColor<br />
&gt;&gt;                     }<br />
&gt;&gt;                 }<br />
&gt;&gt;                 else<br />
&gt;&gt;                 {<br />
&gt;&gt;                 Write-Host $ConnectionName &#8220;is not pingable&#8221;<br />
&gt;&gt;                 $NoPingMessage = &#8220;Server &#8220;&#8221;" + $ConnectionName + &#8220;&#8221;" could not be reached.`nPlease verify it is on th<br />
e network and pingable.&#8221;<br />
&gt;&gt;                 Write-Event $EventSource $NoPingEventID &#8220;Warning&#8221; $NoPingMessage &#8220;Application&#8221;<br />
&gt;&gt;                 }<br />
&gt;&gt;             }<br />
&gt;&gt;<br />
&gt;&gt;     }<br />
&gt;&gt;<br />
&gt;&gt; }<br />
&gt;&gt; ## Write my events to the local Application log.<br />
&gt;&gt;<br />
Domain System Volume:SYSVOL Share &#8211; S:MYDC05 R:MYDC01<br />
The term &#8216;dfsrdiag&#8217; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC05 /ReceivingMember:M<br />
VDC01<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC04 R:MYDC01<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC04 /ReceivingMember:M<br />
VDC01<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC02 R:MYDC01<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC02 /ReceivingMember:M<br />
VDC01<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC03 R:MYDC01<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC03 /ReceivingMember:M<br />
VDC01<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC01 R:MYDC02<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC01 /ReceivingMember:MY<br />
DC02<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC01 R:MYDC03<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC01 /ReceivingMember:J<br />
VDC02<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC01 R:MYDC04<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt;&lt;  Backlog /RGName:&#039;Domain System Volume&#039; /RFName:&#039;SYSVOL Share&#039; /SendingMember:MYDC01 /ReceivingMember:E<br />
VDC01<br />
    + CategoryInfo          : ObjectNotFound: (dfsrdiag:String) [], CommandNotFoundException<br />
    + FullyQualifiedErrorId : CommandNotFoundException</p>
<p>Domain System Volume:SYSVOL Share &#8211; S:MYDC01 R:MYDC05<br />
The term &#039;dfsrdiag&#039; is not recognized as the name of a cmdlet, function, script file, or operable program. Check the sp<br />
elling of the name, or if a path was included, verify that the path is correct and try again.<br />
At line:1 char:9<br />
+ dfsrdiag &lt;&lt;&lt; if ($SuccessAudit -ne $Null)<br />
&gt;&gt; {<br />
&gt;&gt;     Write-Event $EventSource $SuccessEventID &#8220;Information&#8221; $SuccessAudit &#8220;Application&#8221;<br />
&gt;&gt; }<br />
&gt;&gt;<br />
PS C:\Windows\system32&gt; if ($WarningAudit -ne $Null)<br />
&gt;&gt; {<br />
&gt;&gt;     Write-Event $EventSource $WarningEventID &#8220;Warning&#8221; $WarningAudit &#8220;Application&#8221;<br />
&gt;&gt; }<br />
&gt;&gt;<br />
PS C:\Windows\system32&gt; if ($ErrorAudit -ne $Null)<br />
&gt;&gt; {<br />
&gt;&gt;     Write-Event $EventSource $ErrorEventID &#8220;Error&#8221; $ErrorAudit &#8220;Application&#8221;<br />
&gt;&gt;<br />
&gt;&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-553</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Tue, 22 Mar 2011 21:07:25 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-553</guid>
		<description>&lt;a href=&quot;#comment-552&quot; rel=&quot;nofollow&quot;&gt;@Mark A. Weaver &lt;/a&gt; 

nope, i don&#039;t see it, command worked but the list/table is empty.</description>
		<content:encoded><![CDATA[<p><a href="#comment-552" rel="nofollow">@Mark A. Weaver </a> </p>
<p>nope, i don&#8217;t see it, command worked but the list/table is empty.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark A. Weaver</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-552</link>
		<dc:creator>Mark A. Weaver</dc:creator>
		<pubDate>Sat, 19 Mar 2011 01:37:35 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-552</guid>
		<description>Interesting... I hadn&#039;t seen that before...

If you just do a :
   Get-WmiObject -Namespace &quot;root\MicrosoftDFS&quot; -query &quot;SELECT * FROM DfsrReplicationGroupConfig&quot; &#124; Select-Object ReplicationGroupName

Do you see your replication group (non-SYSVOL) that you created?

   Mark</description>
		<content:encoded><![CDATA[<p>Interesting&#8230; I hadn&#8217;t seen that before&#8230;</p>
<p>If you just do a :<br />
   Get-WmiObject -Namespace &#8220;root\MicrosoftDFS&#8221; -query &#8220;SELECT * FROM DfsrReplicationGroupConfig&#8221; | Select-Object ReplicationGroupName</p>
<p>Do you see your replication group (non-SYSVOL) that you created?</p>
<p>   Mark</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-551</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Fri, 18 Mar 2011 13:47:48 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-551</guid>
		<description>so i ran this script, the original at the top, and its picking up my SYSVOL replication only and not my replication group i created manually.  How do i get this to stop looking at my SYSVOL replication?

I am running win2k8 R2 with DFS-R replication group.</description>
		<content:encoded><![CDATA[<p>so i ran this script, the original at the top, and its picking up my SYSVOL replication only and not my replication group i created manually.  How do i get this to stop looking at my SYSVOL replication?</p>
<p>I am running win2k8 R2 with DFS-R replication group.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark A. Weaver</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/comment-page-1/#comment-550</link>
		<dc:creator>Mark A. Weaver</dc:creator>
		<pubDate>Thu, 03 Mar 2011 00:34:48 +0000</pubDate>
		<guid isPermaLink="false">http://vmweaver.com/?p=126#comment-550</guid>
		<description>Awesome! Do you have a link that you can post to it? 

 -- Mark</description>
		<content:encoded><![CDATA[<p>Awesome! Do you have a link that you can post to it? </p>
<p> &#8212; Mark</p>
]]></content:encoded>
	</item>
</channel>
</rss>

