Working with DFSR

I’ve recently setup a DFS Namespace on windows 2008 R2 servers and applied all recommended patches that can be found on this page: List of currently available hotfixes for Distributed File System (DFS) technologies in Windows Server 2008 and in Windows Server 2008 R2

I didn’t notice until the following blog post – “Understanding DFSR Dirty (Unexpected) Shutdown Recovery” – but there’s a major change in the recovery method after an unexpected shutdown.

I’ve also had a unexpected shutdown of one of the servers because of a bad power cable 😦

As I’ve applied KB2663685 and already experienced an unexpected shutdown I can troubleshoot if the replication is “broken” but querying the eventlog for event 2213 as indicated.

Get-WinEvent -FilterHashtable @{LogName="DFS Replication";ProviderName="DFSR";Id=2213}            
(Get-WinEvent -FilterHashtable @{LogName="DFS Replication";ProviderName="DFSR";Id=2213})[0].Message

DFSR event ID 2213

The KB article and the blog post also reveals that DFSR related info is stored in the root\MicrosoftDFS namespace.
So to list all the DFSR classes under this namespace and their description, we can do

Get-WmiObject   -Namespace "Root\MicrosoftDFS" -list Dfsr* -Amended | foreach {$_.Name;"="*($_.Name).Length ; $_.Qualifiers | Select-Object Name,Value  | Format-Table Name,Value -Wrap -AutoSize}

DFSR Class description

To restore manually the synchronisation, I prefer using powerwhell rather than the wmic (WMI console) utility.
As I’ve only one object returned when querying the class DfsrVolumeConfig, as I’m using powershell V2 and as the ResumeReplication method doesn’t require any argument (otherwise I’d have used Invoke-WMI cmdlet), I can simply and directly do:

(Get-WmiObject   -Namespace "Root\MicrosoftDFS" -Class DfsrVolumeConfig).ResumeReplication()

Note that once you’ve initiated the manual recovery, the event 2212 is logged to indicate that it has started the recovery. Once completed, you get an event Id 2214.

Get-WinEvent -FilterHashtable @{LogName="DFS Replication";ProviderName="DFSR"} -maxevents 2 | Format-Table Id,Message -Wrap -AutoSize

DFSR manual recovery completed

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s