Getting started with Task Scheduler

PowerShell script exchange

Getting started with Task Scheduler

Veeam Logoby Shralok » Tue Jan 29, 2013 7:57 pm

I am going to try and use Task Scheduler so that I can tell Veeam what specific time I want my Full Backups to start on the jobs I have which run every 6 hours. Currently the full runs at 17:00 and I have 5 different jobs that are on the same schedule, so I need to space them out.

When using Task Scheduler, I would think I need to somehow "call" PowerShell

I am on the "New Action" portion of the "Create Task" and I am unsure of what to put in. Do I enter the path to my .ps1 file and Windows knows to run it with PowerShell?

Here is my script:
Code: Select all
Get-VBRJob | where {$_.Name –eq “Server1”} | Start-VBRJob -FullBackup


Do I need to add this code since I am not running it from Veeam GUI --> Options --> PowerShell (therefore it doesn't know about the VeeamPSSnapIn to begin with)?
Code: Select all
Add-PSSnapin VeeamPSSnapIn


Slightly confused here... and support told me that they do not support scripting in PowerShell for Veeam... :?: :|

Once I get this figured out, I can turn this into a "FAQ" post that will go over the basics of getting started with Task Scheduler.

Thanks!
Shralok
Enthusiast
 
Posts: 51
Liked: 5 times
Joined: Wed Aug 29, 2012 5:36 pm
Full Name: Shralok

Re: Getting started with Task Scheduler

Veeam Logoby v.Eremin » Wed Jan 30, 2013 9:47 am

In fact, there is a couple of ways how you can achieve your goal. The first is using a scheduled task to run a Windows PowerShell command, and the second scenario is using a scheduled task to run a Windows PowerShell script.

Below you can find list of necessary actions for both of the methods:

1. Command: Call PowerShell, specify the command parameter, and then use the ampersand, a pair of curly brackets, and the Windows PowerShell command you wish to run.

In other words, the Program/Script section should include this line: powershell.
Arguments section: -command &{Add-PSSnapin VeeamPSSnapIn; Get-VBRJob | where {$_.Name –eq “Server1”} | Start-VBRJob –FullBackup;}

Image

2.Script: Program/Script: powershell. Arguments: -file “Your script path”

* Syntax of your script should look like this:

Code: Select all
Add-PSSnapin VeeamPSSnapIn
Get-VBRJob | where {$_.Name –eq “Server1”} | Start-VBRJob –FullBackup


Image

As to the VeeamPSSnapin, it should be called in order to leverage Veeam special methods.

In addition, may I ask what your ticket number is?

Hope this helps.
Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Getting started with Task Scheduler

Veeam Logoby Shralok » Wed Jan 30, 2013 2:38 pm

Thank you I will try this today.

Case # 00176538
Shralok
Enthusiast
 
Posts: 51
Liked: 5 times
Joined: Wed Aug 29, 2012 5:36 pm
Full Name: Shralok

[MERGED] Run current backup job twice or more each day.

Veeam Logoby cmt » Wed Jan 04, 2017 11:23 am

Hi,

Before writing this topic i have searched this forum to find the answer. But no luck at finding the solution.
I'm currently running Backup & Replication v 9.0.

My question is how do i script my backup job called "Backup VM1" to run daily at 05:00 and 12:00.
If someone could help me making the script with the appropriate schedule options that would be great!

The second step i need help with is how to actually run the script. :roll:
Once i have the right script what do i do with it? Save it to a file and run it with a scheduled task?
Use powershell? :shock:
cmt
Lurker
 
Posts: 1
Liked: never
Joined: Wed Jan 04, 2017 11:08 am
Full Name: CMT

Re: Getting started with Task Scheduler

Veeam Logoby v.Eremin » Wed Jan 04, 2017 11:45 am

Check the post above to get the general idea how the script can be triggered via Task Scheduler.

As to the script, use the example mentioned in this thread - just disregard -FullBackup parameter.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests