RESTOREDFSR.VBS Version 3 now available

RESTOREDFSR.VBS Version 3 now available

  • Comments 6
  • Likes

Hello folks, Ned here again. The infamous restoredfsr.vbs has now been rewritten (thanks for the prodding MLatCC) and it fixes some bad design limits of the older versions that were caused by time constraints and apathy. For those of you have not had the “pleasure” of restoredfsr.vbs:


Update 6/12/14

Well that gallery is kaput. Now hosted from here.

This old script is really gross, I recommend instead using our new Windows PowerShell cmdlet Restore-DfsrPreservedFiles instead. You can restore from 8.1 client if you install RSAT, or from a WS2012 R2 server. Can either run locally or just map a drive to \\dfsrserver\h$ or whatever the root drive is, then restore.

Take a look at for steps on using this cmdlet.


A simple vbscript to allow recovery of DFS Replicated files that have been pushed into the ConflictAndDeleted or PreExisting folders due to misadventure.
Remember, this script must be run from a CMD prompt using cscript.exe. Don't just double-click it.


The script also requires to edit three paths (your source files, a new destination path, and the XML manifest you are calling). If you fail to edit those the script will exit with an error.

' Section must be operator-edited to provide valid paths

' Change path to specify location of XML Manifest
' Example 1: "C:\Data\DfsrPrivate\ConflictAndDeletedManifest.xml"
' Example 2: "C:\Data\DfsrPrivate\preexistingManifest.xml"


' Change path to specify location of source files
' Example 1: "C:\data\DfsrPrivate\ConflictAndDeleted"
' Example 2: "C:\data\DfsrPrivate\preexisting"

SourceFolder = ("C:\your_replicated_folder\DfsrPrivate\ConflictAndDeleted")
' Change path to specify output folder

OutputFolder = ("c:\your_dfsr_repair_tree")


This script is an unsupported, as-is, no-warranty, last gasp, solution. If you are using it, you don’t have any backups, you are not using Previous Versions, and you are praying that you have not hit the conflictanddeleted quota (which is only 660MB by default).

This new version now properly detects all file and folder types, runs a bit faster, and no longer requires weird trailing backslashes. It does not support command-line arguments as the very idea bores me to tears.

Make sure you destroy all previous versions of this script you have lying around.

- Ned “mail sack doubtful” Pyle

  • Sweet!  Now I don't have to worry about stepping up to your challenge to re-write this in PowerShell.  :-D  Nice work on trimming down the script and the effeciency gains too!

  • Well I figured if you could write a giant awesome new Psh script, I could at least fix an old gross vb script...

  • Hi Ned,

    I was quite surprised, that you minimized the script using the GetFile method.

    The resulting error code 53 [0x35] only means "File not found." and both occurs if the source folder was not found and also if the source file was not found.

    In following of this: you try to copy the source even if it was not found.

    Ok, we don't have to care about attributes, because DFSR moves the files and folders out of the way including their attributes.

    If nobody did manipulate the attributes, we only have to check, if the physical source is a file or folder.

    So, use this instead:

    If fso.FileExists(Source) Then

    Set f = fso.GetFile(Source)

    WScript.Echo """" & Source & """ is a file. [Attributes: 0x" & Hex(f.Attributes) & "]"

    'do XCOPY with file specific options

    ElseIf fso.FolderExists(Source) Then

    Set f = fso.GetFolder(Source)

    WScript.Echo """" & Source & """ is a file. [Attributes: 0x" & Hex(f.Attributes) & "]"

    'do XCOPY with folder specific options


    WScript.Echo "ERROR: """ & Source & """ does not exist."

    End If

  • ...and maybe you also should define the letters for the "ECHO <letter> |" part,

    because D == directory and F == file only works in an english installed OS ;)

    So, this would give some script user a hint on this behaviour ^^

  • little mistype:

    Set f = fso.GetFolder(Source)

    WScript.Echo """" & Source & """ is a file <== should called folder of course ^^