Link to home
Start Free TrialLog in
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.
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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

Avatar of dedri

ASKER

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.
My guess would be that whatever program is creating those files is the one setting the temporary flag, so I would look there first.
Avatar of dedri

ASKER

programs are MS OFFICE word, excel, powerpoint, Adobe reader, all standard programs.
Sorry, I don't have any suggestions on how to prevent this.