Search Wiki:
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.

CSCRIPT.EXE RESTOREDFSR.VBS

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"

objXMLDoc.load("C:\your_replicated_folder\DfsrPrivate\ConflictAndDeletedManifest.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.

    • DO NOT JUST COPY THE TEXT ON THIS SCREEN - DOWNLOAD THE SCRIPT FROM THE DOWNLOADS PAGE. OTHERWISE YOU WILL RECEIVE ERROR:

"VBSCript error: Object required: 'objXMLDoc'

**

Last edited Aug 2 2012 at 10:40 PM  by NedPyleMSFT, version 5
Comments
ThomasT wrote  Jan 24 2012 at 1:53 PM  
I'd like to mention that the script works fine. But even better if you keep your OS language in mind. As it comes to this moment where you echo in the answer to xcopy's question for file or directory. And the english script of course answers F for file and D for directory. In the german version of Windows it is more suitable to answer D for Datei and V for Verzeichnis. And this might be likewise in other languages.

Sean409 wrote  Nov 9 2012 at 3:43 PM  
Life Saver. Thank you!

kylermiddleton wrote  Feb 25 2013 at 7:14 PM  
Just wanted to say that this script is incredible -- saved a massive amount of time renaming and restructuring the file tree that DFS moved.

Thank you so much for putting this here -- it saved the day.
Thanks!

Hartmanos wrote  Oct 18 2013 at 1:00 PM  
I'm so greatfull that i thank GOD to have created you and wish him bless you!! Thanks for this major help! I'm now able to restore entirely and accurately the files within ConflictAndDelete folders!!! Thank you guy!

Aethernex wrote  Jan 11 at 4:49 PM  
I'm hoping someone is still paying attention to this thread. I have 2 Storage Server 2012 machines that had their JET databases corrupted, and have many files in these folders due to the repair. Where this script was created before the release of Storage Server 2012, I was hoping someone could tell me if this should/would work. I imagine it will, but don't want to chance it on our production servers. Of course Microsoft included this functionality in R2 though...

Thanks in advance,

Jim

abaig wrote  Apr 2 at 10:14 PM  
Dim ofile
Dim Source
Dim Dest
Dim msg
Const quote = """"
Const BS = "\"


' Startup XML
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False

' Set File Read Environment
Set objShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")


'=======================================================================
' Section must be operator-edited to provide valid paths
'=======================================================================

' Change path to specify location of XML Manifest
"H:\SanDiego\Share\DfsrPrivate\ConflictAndDeletedManifest.xml"
"H:\SanDiego\Share\DfsrPrivate\preexistingManifest.xml"

objXMLDoc.load("H:\SanDiego\Share\DfsrPrivate\ConflictAndDeletedManifest.xml")

' Change path to specify location of source files

"H:\SanDiego\Share\DfsrPrivate\ConflictAndDeleted"
"H:\SanDiego\Share\DfsrPrivate\preexisting"

SourceFolder = ("H:\SanDiego\Share\DfsrPrivate\ConflictAndDeleted")

' Change path to specify output folder

OutputFolder = ("H:\Backup\")

I am getting
D:\Tools\restoredfsr\restoredfsrSandy.vbs(70, 2) Microsoft VBScript compilation
error: Expected statement

abaig wrote  Apr 2 at 10:14 PM  
What i am doing wrong here please advice. Thanks

SFJohnson wrote  Apr 16 at 9:35 PM  
abaig,
It appears that you uncommented the example text. Do not uncomment the Example lines. Only change the "objXMLDoc.load" and "SourceFolder" strings.

Try this:

'=======================================================================
' 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"

objXMLDoc.load("H:\SanDiego\Share\DfsrPrivate\ConflictAndDeletedManifest.xml")

' Change path to specify location of source files

' Example 1: "C:\data\DfsrPrivate\ConflictAndDeleted"
' Example 2: "C:\data\DfsrPrivate\preexisting"

SourceFolder = ("H:\SanDiego\Share\DfsrPrivate\ConflictAndDeleted")

' Change path to specify output folder

OutputFolder = ("H:\Backup\")

Updating...
Page view tracker