WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Symantec LiveStateRecovery ImageJob Code



;-------- Create a LiveStateRecovery Automation object --------
v2iAuto = 0
ErrorMode(@off)
v2iAuto = ObjectCreate("Symantec.ProtectorAuto")
ErrorMode(@cancel)
If(v2iAuto == 0) 
        	Message( "Error", "Cannot create v2iAuto object")
			exit
Endif
    
; ------ Connect to the local agent ------
; Connect to the local agent
computername = ItemExtract(1,WinSysInfo(),@TAB)
V2iAuto.Connect(computername) ;or any computer with agent

; ------ Define the local destination to store the image files (uses FolderLocation) ------
oLocation = 0
ErrorMode(@off)
oLocation = ObjectCreate("Symantec.LiveStateRecovery.FolderLocation")
ErrorMode(@cancel)
If(oLocation == 0) 
	    Message( "Error", "Cannot create oLocation")
		 exit
Endif
;	oLocation.Path = sFolder				'' store the images to passed local folder
oLocation.Path = "X:\"					; store the images to passed local folder
oLocation.FileSpec = "SystemBackup"			; filename	

   
; ------ Find and select the System Volume to image ------
oVolume = 0			; assume we won't find it
ForEach oTempVol in v2iAuto.Volumes(@False)
		If (oTempVol.System) 
			oVolume = oTempVol
			Break			; found it
		EndIf
Next
	
If (oVolume == 0)
		Message("Error", "Cannot find requested volume")
		Exit
Endif

Pause("Debugging oVolume.DisplayName",oVolume.DisplayName) ;remove once debugged


;------ Create the Base job ------
oTaskBase =  0
ErrorMode(@off)
oTaskBase = ObjectCreate("Symantec.Scheduler.Task")
ErrorMode(@cancel)
If(oTaskBase == 0) 
	    Message( "Error", "Cannot create oTaskBase")
		 exit
Endif
oTaskBase.Description = "Base Backup"
oTaskBase.StartDateTime = "08/16/2004 18:00"			; GMT
oTaskBase.RepeatInterval = oTaskBase.Constants.IntervalWeekly
oTaskBase.AddRepeatDay(2)				; Tuesday
oTaskBase.Validate()				; Make sure the task is built correctly

; ------ Create the Incremental job ------
oTaskIncr =  0
ErrorMode(@off)
oTaskIncr = CreateObject("Symantec.Scheduler.Task")
ErrorMode(@cancel)
If(oTaskIncr == 0) 
	    Message( "Error", "Cannot create oTaskIncr")
		 exit
Endif
oTaskIncr.Description = "Incremental Backup"
oTaskIncr.StartDateTime = "14:00"				; GMT
oTaskIncr.SetClientTimeZone()
oTaskIncr.RepeatInterval = oTaskIncr.Constants.IntervalWeekly
oTaskIncr.RepeatHourEndTime = "22:00"				; GMT
oTaskIncr.SetRepeatHourInterval(6)
oTaskIncr.AddRepeatDay(0)				; Sunday
oTaskIncr.AddRepeatDay(1)				; Monday
oTaskIncr.AddRepeatDay(2)				; Tuesday
oTaskIncr.AddRepeatDay(3)				; Wednesday
oTaskIncr.AddRepeatDay(4)				; Thursday
oTaskIncr.AddRepeatDay(5)				; Friday
oTaskIncr.AddRepeatDay(6)				; Saturday
oTaskIncr.Validate()				; Make sure the task is built correctly


; ------ Assign the Tasks to the Job ------
oImageJob = 0
oImageJob = ObjectCreate("Symantec.LiveStateRecovery.ImageJob")
ErrorMode(@cancel)
If(oImageJob == 0) 
	    Message( "Error", "Cannot create oImageJob")
		 exit
Endif



oImageJob.Type = oImageJob.Constants.ImageTypeBase
oImageJob.IncrementalSupport = @True
oImageJob.Reason = oImageJob.Constants.ImageReasonManual
oImageJob.RunOnce = @False
oImageJob.DisplayName = StrCat("Backup of " , oVolume.DisplayName)
oImageJob.Description = "Backup image of the system volume."
oImageJob.Compression = oImageJob.Constants.ImageCompressionLow
oImageJob.Volumes = oVolume.ID
oImageJob.Location(oVolume.ID) = oLocation	; location for this volume's image
oImageJob.Task = oTaskBase			
oImageJob.IncrementalTask = oTaskIncr
oImageJob.Quota = 2			
oImageJob.SkipBadSectors = @True
oImageJob.Password = "V2Ibackup"
oImageJob.Encryption = oImageJob.Constants.ImageEncryptionStandard
oImageJob.ValidateProperties

;Step 7: Do this job now
V2iAuto.AddImageJob(oImageJob)
	
;Step 8: Save the base image job's ID so we can use it later to create incrementals
FilePut( "BaseJobID.txt",oImageJob.ID )
Exit

Article ID:   W16656
File Created: 2005:02:18:12:21:46
Last Updated: 2005:02:18:12:21:46