The Storage Team Blog about file services and storage features in Windows Server, Windows XP, Windows Vista and Windows 7.
--------
02 / JAN, 2008 NOTE: NEW VERSION OF THIS SCRIPT AVAILABLE HERE
'=========================================================================='' ' NAME: RestoreConflicted.VBS'' AUTHOR: James Carr, EPS, Microsoft Corporation ' AUTHOR: Ned Pyle, EPS, Microsoft Corporation' ' ' COMMENT: Disaster Recovery script for pulling DFSR data out of ConflictAndDeleted ' and putting it back into a usable directory tree, preserving paths' names, and security descriptor info.'' USAGE: Replace the 3 variables in the "operator edited" section below' with valid paths. The Script will copy the contents of the CandDFolder' to a specified path, returning files to original names and adding back ' their folder structure at the time of deletion. ' ' It is important to note that duplicate conflicts will not copy - check ' the restoreconflicted.log to see which files need manual intervention' (this is done to prevent the accidental restore of an older conflicted copy)'' Finally: this tool can only copy files that were preserved in ConflictAndDeleted' by quota (by default, 660MB). If the quota prevented all files from being saved' this script is not going to help for those that were trimmed out.'' VERSION HISTORY:'' 1.01 / 09/25/06 - ' Added support for whitespace in shelled XCOPY commands (thanks to sabinn, kapilme for catching) '' 1.00 / 08/25/06 - ' First working version''' This script is provided "AS IS" with no warranties, and confers no rights.' For more information please visit ' http://www.microsoft.com/info/cpyright.mspx to find terms of use.''==========================================================================
Dim SourceDim DestConst quote = """"
' Startup XMLSet objXMLDoc = CreateObject("Microsoft.XMLDOM") objXMLDoc.async = False
' Set File Move EnvironmentSet objShell = WScript.CreateObject("WScript.Shell")
'=======================================================================' Section must be operator-edited to provide valid paths'=======================================================================
' Change path to specify location of C&D ManifestobjXMLDoc.load("C:\replicatedfolder\DfsrPrivate\ConflictAndDeletedManifest.xml")
' Change path to specify location of conflicted filesCandDFolder = ("C:\replicatedfolder\DfsrPrivate\ConflictAndDeleted\")
' Change path to specify output folderOutputFolder = ("c:\dfsr_repair_tree")
'========================================================================
set objRootNodes = objXMLDoc.documentElement.ChildNodes
For Each objRootNode In objRootNodes Set objChildNodes = objRootNode.ChildNodes For Each objChildNode in objChildNodes If objChildNode.nodeName = "Path" then StrFullPath = objChildNode.firstChild.nodeValue end if If objChildNode.nodeName = "NewName" then GuidName = objChildNode.firstChild.nodeValue
If GuidName <> "" then Length = Len(StrFullPath) StrExtract = Mid(strFullPath, 7, Length-6)
Source = CandDFolder & GuidName Dest = OutputFolder & strExtract
wscript.echo "CMD /C XCOPY " & quote & Source & quote & " " & quote & Dest & quote & " " & "/Q /H /R /O" objShell.Run "CMD /C ECHO F | XCOPY " & quote & Source & quote & " " & quote & Dest & quote & " " & "/Q /H /R /O /F >> restoreconflicted.log",0,TRUE
end if end if
Next
Hi, Ned here. In the Directory Services support space here at Microsoft, we are often contacted by customers