Windows Server 2012 DFS not replicating all files

In my testlab, some files were not replicating between two Windows Server 2012 fileservers with the DFS Namespace and DFS Replication role installed.

This was caused by files with the temp attribute which can be done by some applications or when you download files from the internet.
You can check if this is the case by using the PowerShell command below and use your own path name.

Get-ChildItem "C:FolderX" -Recurse | ForEach-Object -process {if(($_.attributes -band 0x100) -eq 0x100) {write-output $_}}

The command will show you all files with the attribute, per folder.

Next, if you want to change these files and remove the attribute, use the command below.

Get-ChildItem "C:FolderX" -Recurse | ForEach-Object -process {if (($_.attributes -band 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}

After modifying my files, replication kicked in within the second and all files were replicated.

4 thoughts on “Windows Server 2012 DFS not replicating all files

  1. This is not working . i tried putting in the command and i get nothing back not even an error . I don’t know if that means there are no files with temp attribute or it just not working .

    Like

    • Hey there navdeep,

      It should at least give back some output of the command when you run it in Powershell. Are you running the command on Windows Server 2012/R2? Make sure the path is correct and you’re running Powershell as administrator.

      Like

  2. I encountered the same problem, but I am not able to solve it by changing the attributes manually or by script because these files get created and deleted throughout the day.

    My situation is that we have two different sites, A and B, where a shared folder is replicated using DFS, and accessed via a namespace. The problem is that when a user on location A opens a spreadsheet, any other user in location A is warned while trying to open the same spreadsheed, while users on location B are not.
    This is because the ~blabla.xlsx file has the Ignore attribute set, and because of that it is not replicated via DFS.
    The solution we came up with is to stop using Microsoft Office and start using LibreOffice instead.
    LibreOffice makes the same type of files, like ~blabla.xlsx#, but they do not have the Ignore attribute set.
    This little file is replicated almost instantly, and our problem is solved.

    Like

    • Hi Bert, sad to hear it didn’t solve your issue. Changing software is not an option in most cases but I’m glad it is for you. In case other people are unable to solve it, remember you can call in on support if you have a contract that allows you to!

      Like

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 )

Connecting to %s