SharePoint Designers

All about Branding & Customizations in SharePoint

Hi Any one please help me on creating Sharepoint backup script for sitecollection which runs for multiple web apps

Views: 13

Reply to This

Replies to This Discussion

Hi Senthil, i dont work that much with backups, and i have not have this specific needs my self. Could powershell help you out here? Check out this at codplex, Full SharePoint backup with Powershell script.
Hey Christian Ståhl,

Thanx for the reply, The link which you provided was helpful..But my requirement is i wann to take back up of all the site collections and multiple web apps. Any way thanx a ton for your help

Thanks,
K.R. Senthil Kumar
Hi All,

At last i have fond a script and it is working great.. Please find below..

Copy and paste the below script to the notepad and name "name.vbs"
create a batch script to run this VB Script
Schedule it.. It works great buddies..
************************************************************************************************
Option Explicit
Const STSADM_PATH = _
"C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\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"
*********************************************************************************************************************
Thats cool Senthil, this one seems to be very usefull when you come to an automatic backup. Nice that you solved this with VB and to enum sites, thats one of the new STSADM commands in SP2 or? Thanks for your sharing!

Reply to Discussion

RSS

Birthdays

Birthdays Today

Birthdays Tomorrow

© 2012   Created by Christian Ståhl.

Badges  |  Report an Issue  |  Terms of Service