Veeam Backup v4 wait command
Hi,
We only want to run one job at a time. I would like to control this via a script but when I put the commands into a batch file it starts each job. Is there any way of starting a job from the command line (either batch or powershell) and getting it to wait until it is completed?
Another option is to query the job to check to see if it is running and doing a loop but I can't see the command to do this in the documentation.
At the moment I am running job after job using the post job activity. This isn't ideal as it has hard to see each step as you have to drill into each job to see what comes next.
Thanks,
Roger
We only want to run one job at a time. I would like to control this via a script but when I put the commands into a batch file it starts each job. Is there any way of starting a job from the command line (either batch or powershell) and getting it to wait until it is completed?
Another option is to query the job to check to see if it is running and doing a loop but I can't see the command to do this in the documentation.
At the moment I am running job after job using the post job activity. This isn't ideal as it has hard to see each step as you have to drill into each job to see what comes next.
Thanks,
Roger
-
- Chief Product Officer
- Posts: 31709
- Liked: 7215 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Veeam Backup v4 wait command
Hello Roger, if you start the job from PowerShell, the script will wait until the job execution finishes before moving to the next statement.
-
- Chief Product Officer
- Posts: 31709
- Liked: 7215 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Veeam Backup v4 wait command
Apparently I missed your question on querying job status, you can use the following PowerShell command for this:
Although you should not need this when starting jobs from PowerShell, as I mentioned above...
Code: Select all
(Get-VBRJob JobName).GetStatus()
Re: Veeam Backup v4 wait command
Great, thanks. What is the retry job command in powershell?
-
- VP, Product Management
- Posts: 27325
- Liked: 2778 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Veeam Backup v4 wait command
Hello Roger,
You can use Set-VBRJobSchedule, that will allow you to edit settings for your scheduled jobs, as well as the settings that are responsible for a retry operation. For more info on the syntax of that commad, please have a look at our User Guide. Hope it helps.
Thank you.
You can use Set-VBRJobSchedule, that will allow you to edit settings for your scheduled jobs, as well as the settings that are responsible for a retry operation. For more info on the syntax of that commad, please have a look at our User Guide. Hope it helps.
Thank you.
Re: Veeam Backup v4 wait command
Thanks but does that work when you run the job from Start-VBRJob? What I want to do is run the jobs via a script, then check to see if it was suscessful. If it failed then delay and run a retry operation. If you shedule the jobs then you have this option but I can't see a way via a script.
Thanks,
Roger
Thanks,
Roger
-
- VP, Product Management
- Posts: 27325
- Liked: 2778 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Veeam Backup v4 wait command
Roger,
If you start the job manually with Start-VBRJob, you can use this for a retry operation:
Also to get the status of the job please use the following command:
Hope it helps
If you start the job manually with Start-VBRJob, you can use this for a retry operation:
Code: Select all
Start-VBRJob JobName -RetryBackup
Code: Select all
(Get-VBRJob JobName).GetStatus()
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Nov 07, 2009 5:30 pm
- Full Name: J J
- Contact:
Re: Veeam Backup v4 wait command
Hi
I have installed Powershell 1.0 (Win 2k3), but cannot make any of the cmdlets work in the powershell console.
Do I have to connect to the Veeam Backup database somehow first, or how does this work?
Any hints on how to get started using Veeam Backup PS scripts / samples will be much appreciated?
I have installed Powershell 1.0 (Win 2k3), but cannot make any of the cmdlets work in the powershell console.
Do I have to connect to the Veeam Backup database somehow first, or how does this work?
Any hints on how to get started using Veeam Backup PS scripts / samples will be much appreciated?
-
- Chief Product Officer
- Posts: 31709
- Liked: 7215 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Veeam Backup v4 wait command
Click Tools > PowerShell in Veeam Backup console to start PowerShell with Veeam Backup extensions available. I know very little about PowerShell, but I think if you just start PowerShell from Windows Start menu, you will need to first load Veeam Backup namespace before you can use our commands. I can find out more details from our PowerShell dev.
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Nov 07, 2009 5:30 pm
- Full Name: J J
- Contact:
Re: Veeam Backup v4 wait command
Thanks Gostev. I hadn't noticed the Tools -> PowerShell. This works from within the Veeam PS console. It would be great if you can find out more from your PowerShell developers.
I would like to write a PS1 script which is being run through windows scheduler - exactly the same thing as Roger is asking for with a "success" check and a delayed retry if not successfull. The big questions is, how do i load up PowerShell from Windows Scheduler with Veeam Backup extensions available.....
I would like to write a PS1 script which is being run through windows scheduler - exactly the same thing as Roger is asking for with a "success" check and a delayed retry if not successfull. The big questions is, how do i load up PowerShell from Windows Scheduler with Veeam Backup extensions available.....
-
- Service Provider
- Posts: 47
- Liked: never
- Joined: Mar 18, 2009 1:05 am
- Contact:
Re: Veeam Backup v4 wait command
Just posting so I can watch this as am interested in this as well.
Would be nice if you guys could present a sample .ps1 script that could do the request above for a few jobs and can either be run interactively or through task schedular.
Just want it so I can get all my jobs to run in the quickest time without complicated scheduling, especially as CBT now allows exterrmely fast backups.
Would be nice if you guys could present a sample .ps1 script that could do the request above for a few jobs and can either be run interactively or through task schedular.
Just want it so I can get all my jobs to run in the quickest time without complicated scheduling, especially as CBT now allows exterrmely fast backups.
-
- Chief Product Officer
- Posts: 31709
- Liked: 7215 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Veeam Backup v4 wait command
So, here is how you register Veeam snap-in in the script:Gostev wrote:Click Tools > PowerShell in Veeam Backup console to start PowerShell with Veeam Backup extensions available. I know very little about PowerShell, but I think if you just start PowerShell from Windows Start menu, you will need to first load Veeam Backup namespace before you can use our commands. I can find out more details from our PowerShell dev.
Code: Select all
Add-PSSnapin VeeamPSSnapIn
Code: Select all
Get-PSSnapin
-
- Chief Product Officer
- Posts: 31709
- Liked: 7215 times
- Joined: Jan 01, 2006 1:01 am
- Location: Baar, Switzerland
- Contact:
Re: Veeam Backup v4 wait command
You just start the jobs sequentially like this:fredbloggs wrote:Would be nice if you guys could present a sample .ps1 script that could do the request above for a few jobs and can either be run interactively or through task schedular.
Code: Select all
Start-VBRJob Job1
Start-VBRJob Job2
Start-VBRJob Job3
Start-VBRJob Job4
Start-VBRJob Job5
...
Start-VBRJob JobN
Re: Veeam Backup v4 wait command
Thanks everyone for your replies.
I'm after a script where I can call each job, it runs the job, at the end it checks the status of that job, if it fails it retries X times and waits X minutes before retrying. If it was successful then it goes to the next job.
I have no experience in Powershell scripts but if I get time I’ll write one and post it but if anyone else feels like doing this then please feel free.
Thanks,
Roger
I'm after a script where I can call each job, it runs the job, at the end it checks the status of that job, if it fails it retries X times and waits X minutes before retrying. If it was successful then it goes to the next job.
I have no experience in Powershell scripts but if I get time I’ll write one and post it but if anyone else feels like doing this then please feel free.
Thanks,
Roger
-
- Influencer
- Posts: 10
- Liked: never
- Joined: Nov 07, 2009 5:30 pm
- Full Name: J J
- Contact:
Re: Veeam Backup v4 wait command
Thanks Gostev for the information.
With your help we help we now have some basic PS scripts that runs the backups one at a time. Works perfect.
Would still be nice to do a check at the end and retry failed jobs, but I too have no Powershell experience, and no idea how to script such a thing...
Regards
JJ
With your help we help we now have some basic PS scripts that runs the backups one at a time. Works perfect.
Would still be nice to do a check at the end and retry failed jobs, but I too have no Powershell experience, and no idea how to script such a thing...
Regards
JJ
-
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Oct 13, 2011 11:46 am
- Contact:
Re: Veeam Backup v4 wait command
I have B&R standard v5.2 - Im not sure if I understand but do I put the code "Start-VBRJob Job1" ("job1" being the name of the job) in the post script line? and for the next backup put "Start-VBRJob Job2" and so on down the list? I have 13 servers that I want to fire off sequentially
-
- VP, Product Management
- Posts: 27325
- Liked: 2778 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Veeam Backup v4 wait command
Not really, powershell cmdlets will not be recognized by post backup job script line. You need to wrap it into a batch file first, then trigger this file from the job.
If you want to daisy chain backup jobs then look through this topic for more details.
If you want to daisy chain backup jobs then look through this topic for more details.
-
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Oct 13, 2011 11:46 am
- Contact:
Re: Veeam Backup v4 wait command
So I would create a batch file for each individual backup then run the batch in post script ? Sorry I dont know PS at all and I am trying to figure this out.
-
- VP, Product Management
- Posts: 27325
- Liked: 2778 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Veeam Backup v4 wait command
Not exactly. If a first job fails, then your post backup job script will never be triggered, meaning that your PowerShell script will not be triggered either. What I am suggesting is to use a PowerShell script to start your jobs. See example below.
Long version:
Short version:
Also you would need to verify previous job result in your script using the following PowerShell command, and then implement the desired script behavior based on the returned status, in your case it should be start of a subsequent backup job.
Hope this helps!
Long version:
Code: Select all
$job = Get-VBRJob | where {$_.Name –eq “JobName1”}
Start-VBRJob –Job ($job)
Code: Select all
Get-VBRJob | where {$_.Name –eq “JobName1”} | Start-VBRJob
Code: Select all
(Get-VBRJob JobName).GetStatus()
-
- Enthusiast
- Posts: 29
- Liked: 2 times
- Joined: Oct 13, 2011 11:46 am
- Contact:
Re: Veeam Backup v4 wait command
its a start thank you. I dont know PS that well, so excuse my ill formed questions, but do I create the script in a batch then run it via task scheduler? I mean how is this done besides manually running the scripts.
-
- VP, Product Management
- Posts: 27325
- Liked: 2778 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Veeam Backup v4 wait command
Yes, you can do it either with Task Scheduler or start it manually.
Who is online
Users browsing this forum: Google [Bot], pmowork and 11 guests