<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vmweaver.com &#187; dfsr</title>
	<atom:link href="http://vmweaver.com/index.php/tag/dfsr/feed/" rel="self" type="application/rss+xml" />
	<link>http://vmweaver.com</link>
	<description>Mindless ramblings of a geek...</description>
	<lastBuildDate>Thu, 06 Oct 2011 20:42:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Powershell and DFSR</title>
		<link>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/</link>
		<comments>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 16:22:56 +0000</pubDate>
		<dc:creator>Mark A. Weaver</dc:creator>
				<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[dfs]]></category>
		<category><![CDATA[dfsr]]></category>

		<guid isPermaLink="false">http://vmweaver.com/?p=126</guid>
		<description><![CDATA[Sorry for the long delay between posts, but work has been absolutely crazy. Anyway, one of the recent tasks I have been working on is to find a way to check DFSR to make sure that our remote sites are properly replicating data back to our corporate datacenter.  Part of this new infrastructure relies heavily [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry for the long delay between posts, but work has been absolutely crazy.</p>
<p>Anyway, one of the recent tasks I have been working on is to find a way to check DFSR to make sure that our remote sites are properly replicating data back to our corporate datacenter.  Part of this new infrastructure relies heavily on Microsoft DFSR and all the cool stuff it brings (in 2003 R2).</p>
<p>Our support teams have been asking for ways to ensure that data has completely synchronized to our corporate datacenter every night.  Unfortunately there isn&#8217;t an easy way to determine this scriptomatically.  Well leave it to me to try some different things and attempt to put SOMETHING in place to do this.</p>
<p>Basically we have remote sites replicating during non-business-hours back to a central &#8220;hub&#8221; DFSR server.  We would then backup this &#8220;hub&#8221; server with our corporate backup infrastructure.  This is a WHOLE lot easier than getting users in remote sites to swap tapes or whatever and send them offsite, etc. </p>
<p>The only way I have been able to determine the state of replication is to query the &#8220;backlog&#8221; of the remote site DFSR servers.  This should tell us how many files are sitting there awaiting replication. DFSRDIAG is a tool that can help us enumerate these files, but then we have to parse out the data.  We also need to know which replication partner, which replicated folder, and which replication group these remote sites belong to.</p>
<p>One way to enumerate that info is through a WMI query.  From the DFSR &#8220;hub&#8221; server you can enumerate all DFSR connections, groups, folders, etc. by running some queries against the &#8220;MicrosoftDFS&#8221; namespace.  This is different from standard WMI queries because the default namespace (cimv2) does not contain any DFSR configuruations.</p>
<p>Once we connect to this namespace, it is a fairly trivial task to cycle through all the connection partners, replication groups, and replicated folders.</p>
<p>We can then run the &#8220;DFSRDIAG&#8221; tool to see how many files are in the backlog.</p>
<p>Once we have determine how many files are out there for each replicated folder, we then write a custom event log entry and have our monitoring tools pick those up.</p>
<p>For this script I have set a threshold of 10 files before writing an &#8220;error&#8221; event log.  This can easily be changed based on your specific needs, though.  </p>
<p>You should also be able to easily customize the eventIDs and source information by modifying the values assigned to those variables.</p>
<p>For actually writing to the event log, I am &#8220;borrowing&#8221; some code my colleauge <a title="Mike Hays' blog site" href="http://blog.mike-hays.net" target="_blank">Mike </a>put together.</p>
<p>Anyway, I think the script is fairly self explanitory.  If you need additionaly info or have questions, please let me know.</p>
<p>Thanks and happy scripting&#8230;</p>
<p>&#8211; Mark</p>

<div class="wp_syntax"><div class="code"><pre class="powershell" style="font-family:monospace;"><span style="color: #008000;">## Check-DFSR.ps1 script</span>
<span style="color: #008000;">## Written by: Mark A. Weaver</span>
<span style="color: #008000;">## Site: http://www.vmweaver.com</span>
<span style="color: #008000;">## Version: 2.0</span>
<span style="color: #008000;">## Date: 5/7/2009</span>
<span style="color: #008000;">## Purpose: This script will query the local WMI root for DFS replication groups and folders.  </span>
<span style="color: #008000;">##				It will then run DFS utilities to determine the number of files in the backlog on the</span>
<span style="color: #008000;">##          destination partners in the replication group.</span>
<span style="color: #008000;">##          </span>
<span style="color: #008000;">##          This script was written for the spefic use of being run on a centralized DFSR server</span>
<span style="color: #008000;">##          which acts as the HUB for remote office backups.</span>
<span style="color: #008000;">##         </span>
<span style="color: #008000;">##        </span>
<span style="color: #008000;">##          Monitoring Rules can be setup to collect and report on the events being generated.</span>
<span style="color: #008000;">## </span>
<span style="color: #008000;">##          Event information is written to the Application log using the EventIDs at the bottom.</span>
<span style="color: #008000;">## Input: None</span>
<span style="color: #008000;">#############################</span>
<span style="color: #008000;">## Updates:</span>
<span style="color: #008000;">##  20090408 Weaver: Fixed issue where multiple events are generated throughout the execution</span>
<span style="color: #008000;">##  20090408 Weaver: Added BacklogFileCount to event message</span>
<span style="color: #008000;">##  20090409 Weaver: Fixed list of replication connections issue due to change in replication topology</span>
<span style="color: #008000;">##  20090507 Weaver: Added functionality to return results from all partners in the replication</span>
<span style="color: #008000;">##</span>
<span style="color: #008000;">##</span>
<span style="color: #008000;">######################################################################</span>
<span style="color: #008000;">######################################################################</span>
<span style="color: #008000;"># Write-Event powershell function</span>
<span style="color: #008000;"># Written by Mike Hays</span>
<span style="color: #008000;"># http://blog.mike-hays.net</span>
<span style="color: #008000;">#</span>
<span style="color: #008000;">#</span>
&nbsp;
<span style="color: #0000FF;">function</span> Write<span style="color: pink;">-</span>Event<span style="color: #000000;">&#40;</span>
	<span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$Source</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span><span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;An event Source must be specified.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
	<span style="color: #000000;">&#91;</span><span style="color: #008080;">int</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$EventId</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span><span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;An Event ID must be specified.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
	<span style="color: #000000;">&#91;</span>System.Diagnostics.EventLogEntryType<span style="color: #000000;">&#93;</span> <span style="color: #800080;">$EventType</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span><span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;Event EventType must be specified. (Error, Warning, Information, SuccessAudit, FailureAudit)&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
	<span style="color: #000000;">&#91;</span><span style="color: #008080;">string</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$Message</span> <span style="color: pink;">=</span> $<span style="color: #000000;">&#40;</span><span style="color: #0000FF;">throw</span> <span style="color: #800000;">&quot;An event Message must be specified.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: pink;">,</span>
	<span style="color: #800080;">$EventLog</span>
<span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #008000;">#Uncommon event logs can be specified (even custom ones), but since that isn't generally</span>
	<span style="color: #008000;">#the desired result, I prevent that here</span>
	<span style="color: #800080;">$acceptedEventLogs</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Application&quot;</span><span style="color: pink;">,</span> <span style="color: #800000;">&quot;System&quot;</span>
	<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$eventEventLog</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$null</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #800080;">$eventEventLog</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Application&quot;</span>
	<span style="color: #000000;">&#125;</span>
	<span style="color: #0000FF;">elseif</span> <span style="color: #000000;">&#40;</span><span style="color: pink;">!</span><span style="color: #000000;">&#40;</span><span style="color: #800080;">$acceptedEventLogs</span> <span style="color: #FF0000;">-icontains</span> <span style="color: #800080;">$eventEventLog</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;This function supports writing to the following event logs:&quot;</span> <span style="color: #800080;">$acceptedEventLogs</span>
		<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800000;">&quot;Defaulting to Application Eventlog&quot;</span>
		<span style="color: #800080;">$eventEventLog</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Application&quot;</span>
	<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #008000;">#Create a .NET object that is connected to the Eventlog</span>
	<span style="color: #800080;">$event</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> <span style="color: pink;">-</span><span style="color: #008080; font-weight: bold;">type</span> System.Diagnostics.Eventlog <span style="color: #008080; font-style: italic;">-argumentlist</span> <span style="color: #800080;">$EventLog</span>
	<span style="color: #008000;">#Define the Source property</span>
	<span style="color: #800080;">$event</span>.Source <span style="color: pink;">=</span> <span style="color: #800080;">$Source</span>
	<span style="color: #008000;">#Write the event to the log</span>
	<span style="color: #800080;">$event</span>.WriteEntry<span style="color: #000000;">&#40;</span><span style="color: #800080;">$Message</span><span style="color: pink;">,</span> <span style="color: #800080;">$EventType</span><span style="color: pink;">,</span> <span style="color: #800080;">$EventId</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #008000;">######################################################################</span>
<span style="color: #008000;">######################################################################</span>
<span style="color: #008000;">## Main </span>
<span style="color: #008000;">## Errors written:</span>
<span style="color: #008000;">##   Log File: Application</span>
<span style="color: #008000;">##   Source: Check-DFSR Script</span>
<span style="color: #008000;">##   ID: 9500 - Lists fully replicated replication folders</span>
<span style="color: #008000;">##   ID: 9501 - Lists replication folders with less than the $BacklogErrorLevel files waiting </span>
<span style="color: #008000;">##   ID: 9502 - Lists replication folders with more than the $BacklogErrorLevel files waiting</span>
<span style="color: #008000;">##   ID: 9503 - If a connection is not pingable, this event is written.</span>
&nbsp;
<span style="color: #800080;">$BacklogErrorLevel</span> <span style="color: pink;">=</span> <span style="color: #804000;">10</span> 
&nbsp;
<span style="color: #800080;">$ComputerName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$env</span>:ComputerName
<span style="color: #008000;">## Query DFSR groups from the local MicrosftDFS WMI namespace.</span>
<span style="color: #800080;">$DFSRGroupWMIQuery</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;SELECT * FROM DfsrReplicationGroupConfig&quot;</span>
<span style="color: #800080;">$RGroups</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-WmiObject</span> <span style="color: #008080; font-style: italic;">-Namespace</span> <span style="color: #800000;">&quot;root\MicrosoftDFS&quot;</span> <span style="color: #008080; font-style: italic;">-Query</span> <span style="color: #800080;">$DFSRGroupWMIQuery</span>
&nbsp;
&nbsp;
<span style="color: #008000;">## Setup my variables</span>
<span style="color: #800080;">$ping</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">New-Object</span> System.Net.NetworkInformation.Ping
<span style="color: #800080;">$SuccessAudit</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Null</span>
<span style="color: #800080;">$WarningAudit</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Null</span>
<span style="color: #800080;">$ErrorAudit</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Null</span>
<span style="color: #800080;">$EventSource</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Check-DFSR Script&quot;</span>
<span style="color: #800080;">$SuccessEventID</span> <span style="color: pink;">=</span> <span style="color: #804000;">9500</span>
<span style="color: #800080;">$WarningEventID</span> <span style="color: pink;">=</span> <span style="color: #804000;">9501</span>
<span style="color: #800080;">$ErrorEventID</span> <span style="color: pink;">=</span> <span style="color: #804000;">9502</span>
<span style="color: #800080;">$NoPingEventID</span> <span style="color: pink;">=</span> <span style="color: #804000;">9503</span>
&nbsp;
<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Group</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$RGroups</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #008000;">## Cycle through all Replication groups found</span>
	<span style="color: #800080;">$DFSRGFoldersWMIQuery</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;SELECT * FROM DfsrReplicatedFolderConfig WHERE ReplicationGroupGUID='&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$Group</span>.ReplicationGroupGUID <span style="color: pink;">+</span> <span style="color: #800000;">&quot;'&quot;</span>
	<span style="color: #800080;">$RGFolders</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-WmiObject</span> <span style="color: #008080; font-style: italic;">-Namespace</span> <span style="color: #800000;">&quot;root\MicrosoftDFS&quot;</span> <span style="color: #008080; font-style: italic;">-Query</span> <span style="color: #800080;">$DFSRGFoldersWMIQuery</span>
&nbsp;
	<span style="color: #008000;">## Grab all connections associated with a Replication Group</span>
	<span style="color: #800080;">$DFSRConnectionWMIQuery</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;SELECT * FROM DfsrConnectionConfig WHERE ReplicationGroupGUID='&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$Group</span>.ReplicationGroupGUID <span style="color: pink;">+</span> <span style="color: #800000;">&quot;'&quot;</span>
	<span style="color: #800080;">$RGConnections</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Get-WmiObject</span> <span style="color: #008080; font-style: italic;">-Namespace</span> <span style="color: #800000;">&quot;root\MicrosoftDFS&quot;</span> <span style="color: #008080; font-style: italic;">-Query</span> <span style="color: #800080;">$DFSRConnectionWMIQuery</span>	
	<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Connection</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$RGConnections</span><span style="color: #000000;">&#41;</span>
	<span style="color: #000000;">&#123;</span>
&nbsp;
		<span style="color: #800080;">$ConnectionName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Connection</span>.PartnerName.Trim<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #800080;">$IsInBound</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Connection</span>.Inbound
		<span style="color: #800080;">$IsEnabled</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Connection</span>.Enabled
&nbsp;
		<span style="color: #008000;">## Do not attempt to look at connections that are Disabled</span>
		<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$IsEnabled</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$True</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>  
			<span style="color: #008000;">## If the connection is not ping-able, do not attempt to query it for Backlog info</span>
			<span style="color: #800080;">$Reply</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ping</span>.send<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;$ConnectionName&quot;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$reply</span>.Status <span style="color: #FF0000;">-eq</span> <span style="color: #800000;">&quot;Success&quot;</span><span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
&nbsp;
&nbsp;
				<span style="color: #008000;">## Cycle through the Replication Folders that are part of the replication group and run DFSRDIAG tool to determine the backlog on the connection partners.</span>
				<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$Folder</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$RGFolders</span><span style="color: #000000;">&#41;</span>
				<span style="color: #000000;">&#123;</span>
					<span style="color: #800080;">$RGName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Group</span>.ReplicationGroupName
					<span style="color: #800080;">$RFName</span> <span style="color: pink;">=</span> <span style="color: #800080;">$Folder</span>.ReplicatedFolderName
&nbsp;
					<span style="color: #008000;">## Determine if current connect is an inbound connection or not, set send/receive members accordingly</span>
					<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$IsInBound</span> <span style="color: #FF0000;">-eq</span> <span style="color: #800080;">$True</span><span style="color: #000000;">&#41;</span>
					<span style="color: #000000;">&#123;</span>
						<span style="color: #800080;">$SendingMember</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ConnectionName</span>
						<span style="color: #800080;">$ReceivingMember</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ComputerName</span>
					<span style="color: #000000;">&#125;</span>
					<span style="color: #0000FF;">else</span>
					<span style="color: #000000;">&#123;</span>
						<span style="color: #800080;">$SendingMember</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ComputerName</span>
						<span style="color: #800080;">$ReceivingMember</span> <span style="color: pink;">=</span> <span style="color: #800080;">$ConnectionName</span>
					<span style="color: #000000;">&#125;</span>
					   <span style="color: #800080;">$Out</span> <span style="color: pink;">=</span> <span style="color: #800080;">$RGName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$RFName</span> <span style="color: pink;">+</span>  <span style="color: #800000;">&quot; - S:&quot;</span><span style="color: pink;">+</span><span style="color: #800080;">$SendingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; R:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ReceivingMember</span> 
					   <span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800080;">$Out</span>
						<span style="color: #008000;">## Execute the dfsrdiag command and get results back in the $Backlog variable</span>
						<span style="color: #800080;">$BLCommand</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;dfsrdiag Backlog /RGName:'&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$RGName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;' /RFName:'&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$RFName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;' /SendingMember:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$SendingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; /ReceivingMember:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ReceivingMember</span>
						<span style="color: #800080;">$Backlog</span> <span style="color: pink;">=</span> <span style="color: #008080; font-weight: bold;">Invoke-Expression</span> <span style="color: #008080; font-style: italic;">-Command</span> <span style="color: #800080;">$BLCommand</span>
&nbsp;
						<span style="color: #800080;">$BackLogFilecount</span> <span style="color: pink;">=</span> <span style="color: #804000;">0</span>
						<span style="color: #0000FF;">foreach</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$item</span> <span style="color: #0000FF;">in</span> <span style="color: #800080;">$Backlog</span><span style="color: #000000;">&#41;</span>
						<span style="color: #000000;">&#123;</span>
							<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$item</span> <span style="color: #FF0000;">-ilike</span> <span style="color: #800000;">&quot;*Backlog File count*&quot;</span><span style="color: #000000;">&#41;</span>
							<span style="color: #000000;">&#123;</span>
								<span style="color: #800080;">$BacklogFileCount</span> <span style="color: pink;">=</span> <span style="color: #000000;">&#91;</span><span style="color: #008080;">int</span><span style="color: #000000;">&#93;</span><span style="color: #800080;">$Item</span>.Split<span style="color: #000000;">&#40;</span><span style="color: #800000;">&quot;:&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#91;</span><span style="color: #804000;">1</span><span style="color: #000000;">&#93;</span>.Trim<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
							<span style="color: #000000;">&#125;</span>
&nbsp;
						<span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
						<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$BacklogFileCount</span> <span style="color: #FF0000;">-eq</span> <span style="color: #804000;">0</span><span style="color: #000000;">&#41;</span>
						<span style="color: #000000;">&#123;</span>
							<span style="color: #008000;">#Update Success Audit </span>
							<span style="color: #800080;">$SuccessAudit</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$RGName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$RFName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; is in sync with 0 files in the backlog from &quot;</span><span style="color: pink;">+</span> <span style="color: #800080;">$SendingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; to &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ReceivingMember</span> <span style="color: pink;">+</span><span style="color: #800000;">&quot;.<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span>					
&nbsp;
						<span style="color: #000000;">&#125;</span>
						<span style="color: #0000FF;">elseif</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$BacklogFilecount</span> <span style="color: #FF0000;">-lt</span> <span style="color: #800080;">$BacklogErrorLevel</span><span style="color: #000000;">&#41;</span>
						<span style="color: #000000;">&#123;</span>
							<span style="color: #008000;">#Update Warning Audit</span>
							<span style="color: #800080;">$WarningAudit</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$RGName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$RFName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; has &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$BacklogFileCount</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; files in the backlog from &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$SendingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; to &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ReceivingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;.<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span>
						<span style="color: #000000;">&#125;</span>
						<span style="color: #0000FF;">else</span>
						<span style="color: #000000;">&#123;</span>
							<span style="color: #008000;">#Update Error Audit</span>
							<span style="color: #800080;">$ErrorAudit</span> <span style="color: pink;">+=</span> <span style="color: #800080;">$RGName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;:&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$RFName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; has &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$BacklogFilecount</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; files in the backlog from &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$SendingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot; to &quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ReceivingMember</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;.<span style="color: #008080; font-weight: bold;">`n</span>&quot;</span>
						<span style="color: #000000;">&#125;</span>
						<span style="color: #008000;">#Write-Host + $Folder.ReplicatedFolderName &quot;- &quot; $BackLogFilecount -foregroundcolor $FGColor</span>
					<span style="color: #000000;">&#125;</span>
				<span style="color: #000000;">&#125;</span>
				<span style="color: #0000FF;">else</span>
				<span style="color: #000000;">&#123;</span> 
				<span style="color: #008080; font-weight: bold;">Write-Host</span> <span style="color: #800080;">$ConnectionName</span> <span style="color: #800000;">&quot;is not pingable&quot;</span> 
				<span style="color: #800080;">$NoPingMessage</span> <span style="color: pink;">=</span> <span style="color: #800000;">&quot;Server &quot;</span><span style="color: #800000;">&quot;&quot;</span> <span style="color: pink;">+</span> <span style="color: #800080;">$ConnectionName</span> <span style="color: pink;">+</span> <span style="color: #800000;">&quot;&quot;</span><span style="color: #800000;">&quot; could not be reached.<span style="color: #008080; font-weight: bold;">`n</span>Please verify it is on the network and pingable.&quot;</span>
				Write<span style="color: pink;">-</span>Event <span style="color: #800080;">$EventSource</span> <span style="color: #800080;">$NoPingEventID</span> <span style="color: #800000;">&quot;Warning&quot;</span> <span style="color: #800080;">$NoPingMessage</span> <span style="color: #800000;">&quot;Application&quot;</span>
				<span style="color: #000000;">&#125;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #000000;">&#125;</span>
<span style="color: #008000;">## Write my events to the local Application log.</span>
&nbsp;
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$SuccessAudit</span> <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	Write<span style="color: pink;">-</span>Event <span style="color: #800080;">$EventSource</span> <span style="color: #800080;">$SuccessEventID</span> <span style="color: #800000;">&quot;Information&quot;</span> <span style="color: #800080;">$SuccessAudit</span> <span style="color: #800000;">&quot;Application&quot;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$WarningAudit</span> <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	Write<span style="color: pink;">-</span>Event <span style="color: #800080;">$EventSource</span> <span style="color: #800080;">$WarningEventID</span> <span style="color: #800000;">&quot;Warning&quot;</span> <span style="color: #800080;">$WarningAudit</span> <span style="color: #800000;">&quot;Application&quot;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #0000FF;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #800080;">$ErrorAudit</span> <span style="color: #FF0000;">-ne</span> <span style="color: #800080;">$Null</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
	Write<span style="color: pink;">-</span>Event <span style="color: #800080;">$EventSource</span> <span style="color: #800080;">$ErrorEventID</span> <span style="color: #800000;">&quot;Error&quot;</span> <span style="color: #800080;">$ErrorAudit</span> <span style="color: #800000;">&quot;Application&quot;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://vmweaver.com/index.php/2009/04/powershell-and-dfsr/feed/</wfw:commentRss>
		<slash:comments>81</slash:comments>
		</item>
	</channel>
</rss>

