Veeam has a pretty extensive scheduler for jobs. However sometimes customers really want strange schedules to run their backups. I always try to change the mindset. Sometimes they want to have alternating backups just because they don't know the backup copy job exists in v7. In this case, it's like your Santa bringing them a new Christmas present when you explain them that they can actually copy their backups really easily from repository to repository.
However sometimes they have exotic questions. For example we want to run an active full every 2 weeks. Not every week or every month, no every 2 weeks. So what can you do in this case? Well use the Windows task scheduler and some easy Powershell script that executes your logic.
If you want to use Veeam Powershells snapin, make sure you explicitly install it. It is provided as part of the Veeam Backup & Replication installer, but is not selected by default. To validate, just check if you can find the Powershell option in your main menu.
If you don't have it installed, you can fire up the main installer or just locate the corresponding MSI on the iso ":\Backup\BPS_x64.msi"
The most simple script can be found here:
simplestartjob.ps1
Change the name of the job in the script to match your job you want to start. Then go to the windows task scheduler and make a new task:
Then create a new task. Personally I like to add my Veeam task in a custom folder so that they are all grouped together.
On the general page enable
On the action tab, add a new action
Fill the correct setting
The result should be something like this:
Now create a trigger
You can schedule it daily, weekly or monthly
Finally click ok and enter the credentials.
When the script runs it should start your job
Also I created some scripts in the past for customers:
Why I need to run with highest privileges
Actually if you just open a powershell prompt in non-admin mode and admin mode you will see why
When you run in non-admin mode you will get a SQL error. Actually it is not really about admin mode but more about the fact that the current user doesn't have access to the database. It is actually the same requirement, when you want to give users fine grained access to the GUI. So first of all make sure you setup the correct permissions in B&R itself (Main menu>Users and roles)
Next to that, users also need permissions to the database that is behind B&R
If you give the user db_owner on the Veeam db, it should work as well
However sometimes they have exotic questions. For example we want to run an active full every 2 weeks. Not every week or every month, no every 2 weeks. So what can you do in this case? Well use the Windows task scheduler and some easy Powershell script that executes your logic.
If you want to use Veeam Powershells snapin, make sure you explicitly install it. It is provided as part of the Veeam Backup & Replication installer, but is not selected by default. To validate, just check if you can find the Powershell option in your main menu.
If you don't have it installed, you can fire up the main installer or just locate the corresponding MSI on the iso "
The most simple script can be found here:
simplestartjob.ps1
Change the name of the job in the script to match your job you want to start. Then go to the windows task scheduler and make a new task:
Then create a new task. Personally I like to add my Veeam task in a custom folder so that they are all grouped together.
On the general page enable
- "Run whether user is logged on or not"
- "Run with highest privileges" : If you want to know why you need to enable this, find more info at the end of the blog article. If you don't care, go ahead and continue
On the action tab, add a new action
Fill the correct setting
- Program : powershell
- Arguments : "e:\scripts\simplestartjob.ps1"
The result should be something like this:
Now create a trigger
You can schedule it daily, weekly or monthly
Finally click ok and enter the credentials.
When the script runs it should start your job
Also I created some scripts in the past for customers:
- Activefull.ps1 : Active full which should be run on special time. With the windows task scheduler you can say for example first and third week of the month. Alternatively you can do the alternation in the script itself
- alternate weeks: if( ([int]$(get-date -uformat "%V"))%2 -eq 1) { do_something }
- alternate days: if( ([int]$(get-date -uformat "%j"))%2 -eq 1) { do_something }
- Startjob.ps1 : Launcher script. Instead of making a different script for each job, you can reuse the script and give the job name via a parameter
- Please not that the argument should be something like (single quotes around names). Correct quotes are important "c:\path\to\script\startjob.ps1 'my job name'"
- Stoptapejob : Stop tape job after a certain time. Customer has a single drive and tape job "hang" if there is no drive in the slots and he was canceling them manually every day.
Why I need to run with highest privileges
Actually if you just open a powershell prompt in non-admin mode and admin mode you will see why
When you run in non-admin mode you will get a SQL error. Actually it is not really about admin mode but more about the fact that the current user doesn't have access to the database. It is actually the same requirement, when you want to give users fine grained access to the GUI. So first of all make sure you setup the correct permissions in B&R itself (Main menu>Users and roles)
Next to that, users also need permissions to the database that is behind B&R
If you give the user db_owner on the Veeam db, it should work as well
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.