Skip to main content
SharePoint Forum

SharePoint Forum

Go Search
SharePoint Forum
Blog
Wiki
Sweden SharePoint User Group
SharePoint Resources and Links
Search
About
  
SharePoint Forum > Wiki > Automated Backup  

Automated Backup

Script to run nightly backups for Sharepoint as a Windows Scheduled Task:

””””””’
‘Begin Script
””””””’
Dim fso, f, fspec
dim yr, mo, dt, hr, min, sec

yr = Year(Now)

mo = Month(Now)
if mo < 10 Then
mo = “0″ & mo
end if

dt = Day(Now)
if dt < 10 Then
dt = “0″ & dt
end if

hr = Hour(Now)
if hr < 10 Then
hr = “0″ & hr
end if

min = Minute(Now)
if min < 10 Then
min = “0″ & min
end if

sec = Second(Now)
if sec < 10 Then
sec = “0″ & sec
end if

destFolder = “SPSPortal-” & yr & “-” & mo & “-” & dt & “-” & hr & “-” & min & “-” & sec

Set fso = CreateObject(”Scripting.FileSystemObject”)
Set f = fso.CreateFolder(”D:\SPS2007Backups\SPSPortal-” & yr & “-” & mo & “-” & dt & “-” & hr & “-” & min & “-” & sec) <<<<<<<<< Customize this

bkFolder = f.Path
bkFolder = Replace(bkFolder, “”, “\”)
bkFolder = bkFolder

””””””””””””’
‘Run the spsbackup script
””””””””””””’
Set objShell = CreateObject(”WScript.Shell”)
objShell.CurrentDirectory = “c:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\”

objShell.Exec (”STSADM.exe -o backup -directory ” & bkFolder & ” -backupmethod full”) <<<<<<<<<<<<< You can customize this
 WScript.Echo “Backup Started!”

———————————————————————————–

Save that as a .vbs file and to run it as a scheduled task go to Control PanelScheduled Tasks > Add Scheduled Task > And Follow the Prompts.


Back To Home

Tags
Backup 
Last modified at 2/16/2008 8:03 PM  by Administrator