Monday, September 6, 2010

Backup SharePoint 2010 and C# Source Tree

Running sharepoint on (vm) OBOE. This backs up to THEORY (which is also the VM host). The directory on THEORY is called "theHeapBackup" -- and each backup is yyyy-mmdd-hhmm stamped. Each backup consistes of the SharePoint 2010 content set and the c# source library (for experimental programs like sp and spCmd)







Dependencies/Caveats






Dependent programs are assumed to be available on PATH (and not necessarily in this script's directory.. this is a departure from the accepted standard... sorry). This script uses stamp.exe and roboUpdate.cmd (which has these dependenices: robocopy.exe, stamp.exe and tail.exe). RoboUpdate writes its log file to your %temp% directory, if i recall correctly.






The target machine isn't a member of the domain, so we gotta embed creds (sorry about that). You'll have to visit the value in set myPass=********* and the creds in the net use * %targetRoot% %myPass% /user:THEORY\Nehemiah to get this wet.






The Script






@if not defined DEBUG @echo off


rem backup the heap and the c# source repository 2010-0906


rem put this in \toolkit\tools (uses roboupdate.cmd and stamp.exe


setlocal


set myPath=%~dps0&


set myName=%~n0&


set myPass=*********


for /f "tokens=*" %%m in ('stamp %%w%%a') do set fdr=%%m


for /f "tokens=1*" %%a in ('stamp "%%Y-%%m%%d-%%H%%M %%Y-%%m%%d"') do set dateStamp=%%a&set dirDateStamp=%%b


set stsAdm=C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\STSADM.EXE&


set targetRoot=\\THEORY\C$&


net use * %targetRoot% %myPass% /user:THEORY\Nehemiah


set targetDir=%targetRoot%\theHeapBackup\%dirDateStamp%&


md %targetDir% >NUL 2>&1


set localSharePointTarget=C:\oboe-%dateStamp%-userSec-ver4&


echo Stsadm to ceate SharePoint backup in %localSharePointTarget%


"%stsadm%" -o export -url http://oboe -fileName %localSharePointTarget% -noFileCompression -includeUserSecurity -versions 4


echo Roboupdate to transfer SharePoint backup to %targetDir%


call roboUpdate.cmd %localSharePointTarget% %targetDir%\sharePoint2010


echo Roboupdate to copy source tree for c#


call roboUpdate.cmd C:\toolKit\src\c# %targetDir%\src\c#


:EXITER


endlocal


exit/b


goto :EOF


:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+


:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+


:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+










:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+


:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+


:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+:+


















No comments:

Post a Comment