cancel
Showing results for 
Search instead for 
Did you mean: 
pkh
Moderator
Moderator
   VIP    Certified

This BEMCLI script is a follow-up to my article

https://www-secure.symantec.com/connect/articles/use-bemcli-chain-jobs

This script makes it easier to set up the jobs that you want to run in sequence.

1) Get the list of jobs

You can get the list of jobs that you want to run by running this cmdlet and pipe it to a text file

Get-BEJob | select-object name > jobs.txt

If you want to get only a certain type of job, you can use the parameters of the Get-BEJob cmdlet to do so.  For example,

Get-BEJob -Jobtype Duplicate 

will get you all the duplicate jobs

and

Get-BEJob -Status Missed

will get you the list of of missed jobs.

2) Arrange the job in sequence

Edit the text file with the job names and arrange the jobs in the sequence that you want to run them.  The content of the text file should look something like this

 

Server-1 Backup 00021-Backup                               
Server-3 Backup 00014-Backup                                            
Server-1 Backup 00003-Backup                                            
Server-2 Backup 00008-Backup                                            
Server-1 Backup 00006-Backup                                            

3) Execute the script from the command line or as a pre-/post-command of a job.

Chain-BEJobs "\jobs.txt" "\results.htm"

The first parameter is a file containing the list of jos and the second optional parameter is the file which will contain the results of the jobs.  If the second parameter is omitted, then no result will be output.  You can supply the full path for both files.

 

To prepare your environment to run BEMCLI, you might want to read my article

https://www-secure.symantec.com/connect/articles/preparing-your-powershell-environment-run-bemcli-and-scripts

 

Comments
King_Julien
Level 5

I'll try it this weekend. Hope it works! 

Hellsmk2
Not applicable

This script falls a little short of what I need - it doesn't suspend the job after it has run.

This means I have to manually place each job back on hold every day - which is a nightmare with 100+ servers.

I've tried adding the Suspend-BEJob switch in various plaes without any luck - any chance you could help? I'm trying to avoid having to add a post command in every job, as it will be a nightmare to do, and the PS route is already confusing enough for the admins who will be looking after this.

Cheers

Version history
Last update:
‎06-01-2012 10:51 PM
Updated by:
Moderator