I got this 2003 script from SPSFAQ.com awhile back and have since customized it for the 2007 products. Here’s a 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 Panel > Scheduled Tasks > Add Scheduled Task > And Follow the Prompts. Happy back-ups!

Advertisements