You mean ?
The following code example uses the Stsadm.exe tool to back up all site collections
within a portal site. The code can be copied into a VBScript file (.vbs).
Option Explicit
Const STSADM_PATH = "C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN\stsadm"
Dim objFso, objFolder, objFiles, objFile, objShell, objExec, strResult, objXml, objSc, objUrl, strUrl, strFileName, strCmd
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFso.GetFolder("C:\backup\")
Set objFiles = objFolder.Files
WScript.Echo "Begin backup"
' Delete all backup files currently present in the backup folder.
For Each objFile in objFiles
objFile.Delete(True)
Next
' Retrieves all site collections in XML format.
Set objShell = CreateObject("WScript.Shell")
Set objExec = objShell.Exec(STSADM_PATH & " -o enumsites -url http://woodgrove/")
strResult = objExec.StdOut.ReadAll
WScript.Echo strResult
' Load XML in DOM document so it can be processed.
Set objXml = CreateObject("MSXML2.DOMDocument")
objXml.LoadXML(strResult)
' Loop through each site collection and call stsadm.exe to make a backup.
For Each objSc in objXml.DocumentElement.ChildNodes
strUrl = objSc.Attributes.GetNamedItem("Url").Text
strFileName = "C:\backup\" & Replace(Replace(strUrl, "http://", ""), "/", "_") & ".bak"
strCmd = STSADM_PATH & " -o backup -url """ + strUrl + """ -filename """ + strFileName + """"
WScript.Echo "Backing up site collection " & strUrl & " to file " & strFileName & " using the following command " & strCmd
objShell.Exec(strCmd)
Next
WScript.Echo "Backup of portal site collections successful"
The following code example shows how to call the previous VBScript file. The
code can be copied into a batch file.
cscript [path to backup script]mybackupscript.vbs
change it where it says
. Set objFolder = objFso.GetFolder("C:\backup\”)
Set objExec = objShell.Exec(STSADM_PATH & " -o enumsites -url http://woodgrove/")