Free SharePoint Backups (2 of 4)

SharePoint
This entry is part 2 of 4 in the series Free SharePoint Backups

In the first article, I showed you one way to use a Windows script, batch file and task scheduler to perform a backup of each Site Collection in your farm.

Next up: Backing up the entire farm

This is really very simple. As you may know, you can use the Backup/Restore function in the SharePoint Central Administration interface. Unfortunately, you can’t schedule that. The solution is to use STSADM instead. This small batch file will log the time your backup starts and completes. It uses STSADM to backup the farm to a file share. Additionally, so we don’t have to login to go check out this log file, we can have it emailed to us.

Step 1:
Create the batch file using notepad or another text editor (I like Notepad++)

@ECHO OFF
@ECHO ================================================
@ECHO Backup Script For Office SharePoint Server 2007
@ECHO        Written By: Wahid Saleemi
@ECHO ================================================
@ECHO %date - %time% Backup Started >> D:\BackupBatch\farmbackup.log
stsadm -o backup -backupmethod full -directory \\Backups\Farm -overwrite
@ECHO %date - %time% Backup Complete >> D:\BackupBatch\farmbackup.log
@ECHO Execute the reporter script to email us that backups are done.
cscript D:\BackupBatch\reportfarm.vbs

Step 2:
Create a scheduled task that calls the batch file. I set mine to run using the farm service account at 3am everyday.

Step 3:
Create the vbs file using notepad, paste the following lines in.

'--------------------
' Send Email
'--------------------
Dim FSO, objShell
Dim strVirt, strPath, strReportTo
Dim strFileName, strTempFile, strLogFile
Dim dtmThisMinute, dtmThisHour
Dim dtmThisDay, dtmThisMonth, dtmThisYear

'dtmThisSecond = PadDigits(Second(Now), 2)
'dtmThisMinute = PadDigits(Minute(Now), 2)
'dtmThisHour = PadDigits(Hour(Now), 2)
'dtmThisDay = PadDigits(Day(Now), 2)
'dtmThisMonth = PadDigits(Month(Now), 2)
'dtmThisYear = Year(Now)

	' Define consts
	Const cdoSendUsingMethod = "http://schemas.microsoft.com/cdo/configuration/sendusing"
	Const cdoSendUsingPort = 2
	Const cdoSMTPServer = "http://schemas.microsoft.com/cdo/configuration/smtpserver"
	
	' This is the sender of the report
	strVirt = "http://sharepoint.domain.com"
	strSMTPServer = "mailserver1"
	strReportTo = "portaladmin@domain.com"
	strFrom = "report@domain.com"
	strLogFile = "D:\BackupBatch\farmbackup.log"	

	' This is the subject
	strSubject = "MOSS Farm-level Backup Report for " & dtmThisYear & "-" & dtmThisMonth & "-" & dtmThisDay & "-" & dtmThisHour
	
	Set objMessage = CreateObject("CDO.Message")
	Set objConfig = CreateObject("CDO.Configuration")
	Set objFields = objConfig.Fields
	
	With objFields
		.Item(cdoSendUsingMethod) = cdoSendUsingPort
		.Item(cdoSMTPServer) = strSMTPServer
		.Update
	End With
	
	With objMessage
		Set .Configuration = objConfig
			.To = strReportTo
			.From = strFrom
			.Subject = strSubject
			.AddAttachment strLogFile
			.HTMLBody = "Attached is your farm-level backup for " & strVirt
	End With
	
	objMessage.Send

	Set objMessage = Nothing
	Set objConfig = Nothing
	Set objFields = Nothing
	strHTMLBody = vbNullString
    strFrom = vbNullString
    strSubject = vbNullString
	arrEmailAddress = vbNullString
	intArraySize = vbNullString

Remember to change the str values to your own. (By the way, anyone knows an easier way to do this, let me know! I know the vbscript needs to be cleaned up).

This post showed you how to automate farm-level backups using the free Windows tools and commands available to you. The files are sent to a fire share. That file share can be backed up to tape or disk for archiving if you needed.
Next up, I’ll show you some other things you should backup, such as the 12 hive, and how you can schedule that as well.

0 comments

Free SharePoint Backups (1 of 4)

SharePoint
This entry is part 1 of 4 in the series Free SharePoint Backups

I’ll be writing a series of 4 articles on how to backup SharePoint for free. In future articles we’ll discuss backing up different components you may need to perform a disaster recovery or a simple backup. These are “okay” backup solutions and definitely can’t compare to 3rd party backup solutions which I’ll touch on in the last article of this series.

First up: Backup all Site Collections

Backing up all Site Collections independently has saved me a lot of time. If a Site Owner or even a contributor deletes something important, I can go back to this copy. Its come in handy for those situations where the site just won’t load (web part problem or something else). With SharePoint 2007’s recycle bins, this has become less of an issue but at least for me, hasn’t done away completely for the need of individual Site backups.

This solution has 3 steps: A Windows Script, a batch file, and the task scheduler.

Step 1:

The Windows Script is created by Michael Noel and is part of his book, SharePoint 2007 Unleased. Todd Klindt has kindly hosted the script, it can be found here. I copied the code here for ease, just press down to expand.




 
  
    
************************************************************
SharePoint 2003/2007 Site Backup Tool
************************************************************
    
        
        
        
	    
    
Example:
cscript SPSiteBackup.wsf /path:"\\remoteserver\sharename"
cscript SPSiteBackup.wsf /path:"c:\sitebackups" /smtpserver:"smtpserver.companyabc.com" /report:"SPAdmin@companyabc.com"
    
  
  
 


Step 2:
Create a folder called “BackupBatch” on your data drive (D:\ in the example). Also create a folder on another drive (G:\ in the example) called “Backups”; create a batch file by copying and pasting the example below into notepad. Here’s a sample one that I have created and use. Remember to change your drive letters and file paths.

@ECHO OFF
ECHO ================================================
ECHO Backup Script For Office SharePoint Server 2007
ECHO        Written By: Wahid Saleemi
ECHO ================================================
REM ## Check for STSADM.EXE
D:
CD D:\BackupBatch
IF EXIST D:\BackupBatch\STSADM.EXE GOTO START
COPY "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\STSADM.EXE" "D:\BackupBatch"
:START
REM ## Archive yesterday's backups; Delete 2 days prior
DEL /Q G:\Backups\Daily\Archive\*.DAT
MOVE /Y G:\Backups\Daily\*.DAT G:\Backups\Daily\Archive
REM ## Run the Backup for all WSS Sites
ECHO "Backup Started:" %date% %time% >> dailybackup.log
cscript SPSiteBackup.wsf /virt:"http://sharepoint.domain.com" /path:"G:\Backups\Daily" /smtpserver:"mailserver" /reportto:"PortalAdmin@domain.com"
ECHO "Backup Complete:" %date% %time% >> dailybackup.log

Step 3:
Finally, create a scheduled task that calls the batch file. I set mine to run using the farm service account at 1am everyday.

This post shows you how to create backup files for each Site Collection and store them on the server or to a file share. That file share can be backed up to tape or disk for archiving if you needed. Next up, I’ll show you how I use some of these same techniques to create Farm-level backups.

1 comment

Microsoft SharePoint Administration Toolkit and other Tools

Microsoft, Windows PowerShell, CodePlex

The 4th release of the Microsoft SharePoint Administration Toolkit is now available for download and includes improvements in the SharePoint Diagnostics Tool (SPDiag), a new Permissions Reporting Tool, a new bulk Quota processing tool, in addition to the Security Configuration Wizard Manifests.

To learn more about improvements about this release see the SharePoint Team Blog.

I figured I’d list some other tools that I think are also useful for diagnostics:

  • SharePoint Test Data Population Tool: This is a capacity planning and performance testing tool that populates data for testing SharePoint deployments.
  • Governance and Manageability: CodePlex site that provides small sample governance tools that will help in the management and control aspects of WSS 3.0 and SharePoint Server Deployments. One of my favorites is the Site Life Cycle Management Tool.
  • Gary LaPointe’s STSADM Extensions: A solution package that extends STSADM with a load of useful commands. Gary’s blog also has PowerShell cmdlets and other automation tools for SharePoint.
  • SharePoint 2007 Features: Another CodePlex project that has Features to address deficiencies in SharePoint 2007 or add new capabilities. There are a handful of features that are useful.
  • SharePoint Manager 2007: This is a SharePoint object model explorer. It enables you to browse every site on the local farm and view every property. It also enables you to change the properties.

Please comment if you think of other tools that belong on that list.

4 comments

Explaining SharePoint to Non-Technical Users

SharePoint, Business

How do you explain SharePoint to non-technical users? Microsoft created a video called SharePoint in Plan English. Embedded here:

This is a great example on how SharePoint can improve business processes. See the announcement on the SharePoint Team Blog.

0 comments

SharePoint Podcasts

SharePoint

My friend John Miller saw a podcast he thought I’d be interested in (I was) and sent me the link. This made me think of other podcasts that I listen to. Here’s a list of podcasts that I subscribe to:

The MOSS Show by Hilton Giesenow (6 podcasts)
SharePoint Pod Show by Rob Foster, Nick Swan, and Brett Lonsdale (29 podcasts)
MOSS Gone Wild by Justin Jackson, Todd Kitta (5 podcasts)
Social Media Talk by Mike Ganotti

Also, here’s some other SharePoint podcasts that I found on the interweb:

SharePoint Online Podcast by Erik Gun (1)
SharePoint Start and Learn by Richard Harbridge (1)
SharePoint for Project Management at ThePMPodcast (1)
How BestBuy.com uses SharePoint for Business Process Automation with Sarah Haase (1)

If anyone else has more, send me the links! I commute an hour or more to work each day and some of these are great to listen to while I’m driving. They are all informative and great quality.

0 comments