We have a WSS 3.0 solution.

We want to run a full backup of the SharePoint farm once per day.

What is the best way to do this? Is there a way to shedule backups from within SharePoint or do we need to create a powershell script and use a different tool to schedule it.

3 Answers 3


The most robust, free, plug-n-play solution I've found was this vbscript:

    Option Explicit

' Email source address
Const strFrom = "email@example.com"
'Email destination address
Const strTo = "email@example.com"
' Mail server address
Const strMailserver = "smtp.host.com"
'Mail Server Schema
Const strSchema = "http://schemas.microsoft.com/cdo/configuration/"

Dim varWeekDay, loopCounter, sharepointProcess, NodeList, Node
Dim objShell, objWMIService, objXMLDoc, objEmail, objFSO
Dim strRegKey, strMOSSPath, strBackupLocation, SharPointBackupRestoreTable, strComputer

Set objShell = CreateObject("WScript.Shell")

' Create variable used to contain the name of day
varWeekDay = (WeekdayName(Weekday(date)))

' Obtain the path where stsadm is located on the server
strRegKey = objShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\12.0\Location")
'Sets stsadm folder string
strMOSSPath = strRegKey & "BIN\"

'sets backup folder string
strBackupLocation = "\\server\share$\" & varWeekDay

' Define the path to SharePoint Backup Restore Table file which contains
' crucial information regarding the outcome of the backup
SharPointBackupRestoreTable = strBackupLocation & "\spbrtoc.xml"

'Main Code Starts
'Deletes weekday folder only
Call deleteBackupFolder (strBackupLocation)

'Ensure the script runs in the SharePoint directory
objShell.CurrentDirectory = strMOSSPath

' Execute stsadm backup command
objShell.Run ("stsadm -o backup -directory " & strBackupLocation & " -backupmethod full")

' This Do loop checks the status of the backup process every minute.
' If the backup process hasn't completed within 60 minutes an email is sent to the
' Sharepoint administrator notifying him/her about this, otherwise an email is sent
' notifying the SharePoint Administrator of the outcome of the backup
    loopCounter = loopCounter + 1

    If loopCounter > 60 Then
        Call SendEmail("SharePoint Backup Process exceeded 60 minutes", "SharePoint backup process has been running for over 60 minutes.  Please check progress of backup.")
    End If

    ' Wait for 1 minute
    WScript.Sleep 60000

    ' Check if the backup process (i.e. stsadm.exe) is currently running
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set sharepointProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = 'stsadm.exe'")

    If (sharepointProcess.count) = 0 Then
        ' Backup process has ended therefore check the SharePoint Backup Restore Table to analyse the outcome of the backup
        Set objXMLDoc = CreateObject("Microsoft.XMLDOM")

        objXMLDoc.async = False
        Set NodeList = objXMLDoc.documentElement.selectNodes("//SPErrorCount")

        For Each Node In NodeList
            If (Node.text) <> "0" Then
                ' Backup errors were generated
                Call SendEmail("SharePoint Backup Process Failed", "SharePoint backup failed with errors. Please investigate backup logs")
                ' No backup errors were generated
                Call SendEmail("SharePoint Backup Process successfully completed", "SharePoint backup completed without errors - " & strBackupLocation)
            End If

        Exit Do
    End If


'Sends email with status of backups
Sub SendEmail (subject, body)
    Set objEmail = CreateObject("CDO.Message")

    objEmail.From = strFrom
    objEmail.To = strTo
    objEmail.Subject = subject
    objEmail.Textbody = body
    objEmail.Configuration.Fields.Item _
    (strSchema & "sendusing") = 2
    objEmail.Configuration.Fields.Item _
    (strSchema & "smtpserver") = strMailserver
    objEmail.Configuration.Fields.Item _
    (strSchema & "smtpserverport") = 25

    On Error Resume Next
    On Error GOTO 0
    Call WriteEvent(subject,body)
End Sub

' Log the backup outcome to server application event log
Sub WriteEvent(subject,body)
    If subject = "SharePoint Backup Process successfully completed" Then
        objShell.LogEvent 0, body
        objShell.LogEvent 1, body
    end If
End Sub

Sub deleteBackupFolder (backupLocation)
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    If (objFSO.FolderExists(backupLocation)) Then
        ' Delete existing backup folder
        ' Create new backup folder
        ' Folder not present therefore create new folder
    End If
End Sub

I'd love to say this is my handy work, but it isn't. I'm not sure where I've found it, but it sure is useful.

Cheers, Matt


You can use STSADM command line utility's backup method for full and differential backups. Once you write your batch file, you can schedule it using Windows Scheduler.

Also note that your batch file should be able to generate a new target file name on a daily basis (it may contain file name like ddMMYYYY_FullBackup.bak) so that it does not override the target file every day.


One thing you could consider is backing up the database once per day (or more often), this can be done by simply creating a backup task in SQL Server. You can restore those whenever you like. Also, I assume you've virtualized the server, so a full/incremental server backup would help a bit.

Off-course this is a bit much, so perhaps a backup via stsadm would suffice in your situation. I like the script of iOnline247 very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.