Avatar of dedri
dedriFlag for United States of America asked on

dfsr not replicating all the files

I have been using DFS/DFSR in our enviornment.
We have two FileServers, which have DFSR configured on a lot of shares, so the data can be replicated.

Now I have a issue with DFSR not replicating all files  and I am lost.

 OS version that are used  2008 R2 Sp1 on both ends, same domain.
   
   For example there is a folder on server A that is replicated to server b. It has a folder Data in it, which is configred through DFSR replication and when I check files in both location I can see that the number of files are different.

Dfsrdiag shows in both directions no backlog, partners in sync. No errors show up.

There is bigger enough staging area in place.  Event shows  nothing - it seems DFS just decided to not replicate those files.

I checked the microsoft article about the latest version of dfsr and installed it(https://support.microsoft.com/en-us/kb/968429). The problem still exist. Some files is not replicated, again no files in backlog.  Files in question do not have replication filters configured. Most of them are standard word or excell files.
After digging a little more deeper I found that the most of the files have attribute set to AT, and T means temporary even though that the file is not temporaray one.
As a workaround I found this article http://ss64.com/nt/attrib.html, which says : DFSR will not replicate files if they have the temporary attribute set.
The temporary attribute can be removed by using PowerShell to subtract 0x100:

PS C:\> Get-childitem D:\Data -recurse | ForEach-Object -process {if (($_.attributes -band 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}

I tried to run the script on one of the folder unsuccessfully, because on the folder path I have the symbol "&" and it gives me an error message.
Here is the output of the error message:
PS C:\Users\ad0psr> Get-childitem "G:\ITDepartment\ISS$BCP" -recurse | ForEach-Object -process {if (($_.attributes -ban
d 0x100) -eq 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}
Get-ChildItem : Cannot find path 'G:\ITDepartment\ISS' because it does not exist.
At line:1 char:14
+ Get-childitem <<<<  "G:\ITDepartment\ISS$BCP" -recurse | ForEach-Object -process {if (($_.attributes -band 0x100) -eq
 0x100) {$_.attributes = ($_.attributes -band 0xFEFF)}}
    + CategoryInfo          : ObjectNotFound: (G:\ITDepartment\ISS:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Anyone has an idea how to debug this and solve it completely? The best solution will be something that will prevent normal files to be assigned the T attribute, so I will not have to run this script everyday.
I will appreciate also a help with this script, at least as a workaround to this problem.
Windows Server 2008Microsoft Server OSWindows Server 2012Server SoftwarePowershell

Avatar of undefined
Last Comment
footech

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
footech

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
footech

I'm not sure if your last hex value is correct.  Here's another way that makes it a bit more readable.
$attribs = @{
    READONLY = 0x1
    HIDDEN = 0x2
    SYSTEM = 0x4
    DIRECTORY = 0x10
    ARCHIVE = 0x20
    DEVICE = 0x40
    NORMAL = 0x80
    TEMPORARY = 0x100
    SPARSE_FILE = 0x200
    REPARSE_POINT = 0x400
    COMPRESSED = 0x800
    OFFLINE = 0x1000
    NOT_CONTENT_INDEXED = 0x2000
    ENCRYPTED = 0x4000
}
Get-ChildItem 'G:\ITDepartment\ISS$BCP' -recurse |  Where { $_.attributes -band $attribs.TEMPORARY} | ForEach {$_.attributes = $_.attributes -bXor $attribs.TEMPORARY}

Open in new window

ASKER
dedri

footech, single quotes  did the trick and the script is working now.
10x for your help.
I hoped that anyone will provide any solution for this problem with dfsr, so I will not run the script every day.
footech

My guess would be that whatever program is creating those files is the one setting the temporary flag, so I would look there first.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER
dedri

programs are MS OFFICE word, excel, powerpoint, Adobe reader, all standard programs.
footech

Sorry, I don't have any suggestions on how to prevent this.