' Description:
' Tool for planning and automating files/entries
' Microsoft Office SharePoint Server 2007
'
' Will generate file entry names with the following style: YYYYMMDD
' E.g.: 20070228
Option Explicit
Const BackupPath = "D:\SharePoint_Backup\"
Const C_SiteURL = "http://companyweb"
Const C_NamePrefix = "SharePoint_"
Const C_SharePointBin = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Bin"
Dim fso, folder, filedate, f, file, filesys
Dim sBackupPrefix
set filesys=CreateObject("Scripting.FileSystemObject")
Set fso = CreateObject("Scripting.FileSystemObject")
if Not fso.FolderExists(BackupPath) then
WScript.Echo "The folder " & BackupPath & " does not exist!"
WScript.Quit
end if
Set folder = fso.GetFolder(BackupPath)
filedate = now
Set f = Nothing
' Assigns a name of the new file
sBackupPrefix = BackupPath & year(now) & right("00" & Month(now),2) & right("00" & day(now),2)
Set folder = filesys.CreateFolder(sBackupPrefix)
Dim objShell
Dim strcmd
Set objShell = CreateObject("WScript.Shell")
'msgbox ("C_SiteURL = " & C_SiteURL & ", filename = " & sBackupPrefix )
'WScript.Quit
strcmd = C_SharePointBin & "\stsadm.exe -o backup -url " & C_SiteURL & " -filename " & sBackupPrefix & "\companyweb.bak -backupmethod full -includeusersecurity"
wscript.echo strcmd
objShell.Exec(strCmd)
WScript.Echo "Backup of site collection successful"
Set objshell = nothing
|