cancel
Showing results for 
Search instead for 
Did you mean: 

Need a script to do an specific schedule job

wnetobr
Level 3

Hi all! I have a Sym Backup Exec System Recovery 2010 and I´m trying to run a job at a specific time on the 1st Tuesday of each month.

Well, turns out that it is not possible to do such selection in the program scheduler. So I´m thinking that it may be possible to do by a script (vbs or batch file), but I can´t think in a way of doing it by a batch file and I don´t know how to build a vbs script.

The job is already created, lets call it “Tuesdayjob”, and it is programed to create a single image of the whole system in “c:\backup\”.

Is there a way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions

Markus_Koestler
Moderator
Moderator
   VIP   

This should do the trick: Just replace YOURJOBNAME with the job name of your specific job as it is displayed in the SSR console.

 

 

'''''RunBESRjob.vbs''''''''''
 
Option Explicit
 
Dim oV2iAuto
 Dim oNet
 Dim oCurrentJob
 Dim oImageJob
 Dim sJobID
 Dim sJobName

 sJobName="YOURJOBNAME"
 
'
 ' Step 1: Create a VProRecovery automation object
 '
 Set oV2iAuto = CreateObject("Symantec.ProtectorAuto")
 
'
 ' Step 2: Connect to the local agent
 '
 WScript.Echo "Connecting..."
 Set oNet = CreateObject("Wscript.Network")
 Call oV2iAuto.Connect(oNet.ComputerName)
 
'
 ' Find the image job ID
 '
 For Each oCurrentJob In oV2iAuto.ImageJobs

  if oCurrentJob.DisplayName = sJobName then

   sJobID = oCurrentJob.ID
   WScript.Echo "Job ID is: " & sJobID
   Set oImageJob = oCurrentJob
   WScript.Sleep 500 ' allow console time to refresh if it's running

 end if
 
 Next
 
'Run the image job Now
 
Call oV2iAuto.DoImageJob(oImageJob.ID, oImageJob.Constants.ImageTypeFull)

View solution in original post

10 REPLIES 10

pkh
Moderator
Moderator
   VIP    Certified

Moved this to the correct forum

Markus_Koestler
Moderator
Moderator
   VIP   

yep: You could have a look at the Docs\Automation\PowershellScripts Folder on the product CD. Here you will find RunJobNow.ps1 !

wnetobr
Level 3

The thing is that the 2010 version doesn´t have support for porwershell nor this file in the product CD.

:(

I´ve found that windows task scheduler actually can program a task to do exactly as I want, but I still need a vbs or batch to do the job.

 

Markus_Koestler
Moderator
Moderator
   VIP   

I have something like that, let me get back to you !

Markus_Koestler
Moderator
Moderator
   VIP   

'''''RunBESRjob.vbs''''''''''

Option Explicit

Dim oV2iAuto
Dim oNet
Dim oCurrentJob
Dim oImageJob
Dim sJobID

'
' Step 1: Create a VProRecovery automation object
'
Set oV2iAuto = CreateObject("Symantec.ProtectorAuto")

'
' Step 2: Connect to the local agent
'
WScript.Echo "Connecting..."
Set oNet = CreateObject("Wscript.Network")
Call oV2iAuto.Connect(oNet.ComputerName)

'
' Find the image job ID
'
For Each oCurrentJob In oV2iAuto.ImageJobs
sJobID = oCurrentJob.ID
WScript.Echo "Job ID is: " & sJobID
Set oImageJob = oCurrentJob
WScript.Sleep 500 ' allow console time to refresh if it's running
Next

'Run the image job Now

Call oV2iAuto.DoImageJob(oImageJob.ID, oImageJob.Constants.ImageTypeFull)

 

Source: https://www-secure.symantec.com/connect/forums/running-besr-8x-script-minimized-or-silent-mode

wnetobr
Level 3

Thank you Koestler!

As I´m a newby in vbs, I´ll need some help with the line codes. If you don´t mind...

Which of these are the variables that I have to substitute? And, I notice that I´m going to need the jobID, how can I find the job ID that I want to be trigger?

Thanks again!

wnetobr
Level 3

I´ve tried! It works but did the wrong job or call all the jobs and queued (I didn´t wait to see, it started the wrong job anyway).

So, the next step is tell the program to do just one specific job.

But, how to do that?

 

Markus_Koestler
Moderator
Moderator
   VIP   

This should do the trick: Just replace YOURJOBNAME with the job name of your specific job as it is displayed in the SSR console.

 

 

'''''RunBESRjob.vbs''''''''''
 
Option Explicit
 
Dim oV2iAuto
 Dim oNet
 Dim oCurrentJob
 Dim oImageJob
 Dim sJobID
 Dim sJobName

 sJobName="YOURJOBNAME"
 
'
 ' Step 1: Create a VProRecovery automation object
 '
 Set oV2iAuto = CreateObject("Symantec.ProtectorAuto")
 
'
 ' Step 2: Connect to the local agent
 '
 WScript.Echo "Connecting..."
 Set oNet = CreateObject("Wscript.Network")
 Call oV2iAuto.Connect(oNet.ComputerName)
 
'
 ' Find the image job ID
 '
 For Each oCurrentJob In oV2iAuto.ImageJobs

  if oCurrentJob.DisplayName = sJobName then

   sJobID = oCurrentJob.ID
   WScript.Echo "Job ID is: " & sJobID
   Set oImageJob = oCurrentJob
   WScript.Sleep 500 ' allow console time to refresh if it's running

 end if
 
 Next
 
'Run the image job Now
 
Call oV2iAuto.DoImageJob(oImageJob.ID, oImageJob.Constants.ImageTypeFull)

wnetobr
Level 3

Koestler, YOU ARE THE MAN!

Works perfect!

Thank you very much!

 

 

Markus_Koestler
Moderator
Moderator
   VIP   

No problem ! Please mark this post as solved !