Veeam Backup v4 wait command

PowerShell script exchange

Veeam Backup v4 wait command

Veeam Logoby rogersillars » Mon Nov 02, 2009 8:12 pm

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
rogersillars
Enthusiast
 
Posts: 30
Liked: never
Joined: Tue Jun 23, 2009 10:48 pm
Full Name: Roger Sillars

Re: Veeam Backup v4 wait command

Veeam Logoby Gostev » Mon Nov 02, 2009 8:45 pm

Hello Roger, if you start the job from PowerShell, the script will wait until the job execution finishes before moving to the next statement.
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup v4 wait command

Veeam Logoby rogersillars » Tue Nov 03, 2009 8:21 pm

Thanks. Easy fix :-)
rogersillars
Enthusiast
 
Posts: 30
Liked: never
Joined: Tue Jun 23, 2009 10:48 pm
Full Name: Roger Sillars

Re: Veeam Backup v4 wait command

Veeam Logoby Gostev » Tue Nov 03, 2009 8:45 pm

Apparently I missed your question on querying job status, you can use the following PowerShell command for this:
Code: Select all
(Get-VBRJob JobName).GetStatus()

Although you should not need this when starting jobs from PowerShell, as I mentioned above...
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup v4 wait command

Veeam Logoby rogersillars » Wed Nov 04, 2009 3:03 am

Great, thanks. What is the retry job command in powershell?
rogersillars
Enthusiast
 
Posts: 30
Liked: never
Joined: Tue Jun 23, 2009 10:48 pm
Full Name: Roger Sillars

Re: Veeam Backup v4 wait command

Veeam Logoby Vitaliy S. » Wed Nov 04, 2009 9:03 am

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.
Vitaliy S.
Veeam Software
 
Posts: 19564
Liked: 1104 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Veeam Backup v4 wait command

Veeam Logoby rogersillars » Wed Nov 04, 2009 6:56 pm

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
rogersillars
Enthusiast
 
Posts: 30
Liked: never
Joined: Tue Jun 23, 2009 10:48 pm
Full Name: Roger Sillars

Re: Veeam Backup v4 wait command

Veeam Logoby Vitaliy S. » Thu Nov 05, 2009 10:47 am

Roger,

If you start the job manually with Start-VBRJob, you can use this for a retry operation:
Code: Select all
 Start-VBRJob JobName -RetryBackup

Also to get the status of the job please use the following command:
Code: Select all
 (Get-VBRJob JobName).GetStatus()

Hope it helps
Vitaliy S.
Veeam Software
 
Posts: 19564
Liked: 1104 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Veeam Backup v4 wait command

Veeam Logoby Burnwell » Sat Nov 07, 2009 5:45 pm

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?
Burnwell
Influencer
 
Posts: 10
Liked: never
Joined: Sat Nov 07, 2009 5:30 pm
Full Name: J J

Re: Veeam Backup v4 wait command

Veeam Logoby Gostev » Sat Nov 07, 2009 5:56 pm

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.
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup v4 wait command

Veeam Logoby Burnwell » Sun Nov 08, 2009 5:03 am

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.....
Burnwell
Influencer
 
Posts: 10
Liked: never
Joined: Sat Nov 07, 2009 5:30 pm
Full Name: J J

Re: Veeam Backup v4 wait command

Veeam Logoby fredbloggs » Mon Nov 09, 2009 1:48 am

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.
fredbloggs
Service Provider
 
Posts: 47
Liked: never
Joined: Wed Mar 18, 2009 1:05 am

Re: Veeam Backup v4 wait command

Veeam Logoby Gostev » Mon Nov 09, 2009 11:29 am

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.

So, here is how you register Veeam snap-in in the script:
Code: Select all
Add-PSSnapin VeeamPSSnapIn

This is how you can see all installed PowerShell snap-ins:
Code: Select all
Get-PSSnapin
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup v4 wait command

Veeam Logoby Gostev » Mon Nov 09, 2009 11:30 am

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.

You just start the jobs sequentially like this:
Code: Select all
Start-VBRJob Job1
Start-VBRJob Job2
Start-VBRJob Job3
Start-VBRJob Job4
Start-VBRJob Job5
...
Start-VBRJob JobN
As I stated above, next job in list will not be started until previously started job in list completes execution.
Gostev
Veeam Software
 
Posts: 21396
Liked: 2350 times
Joined: Sun Jan 01, 2006 1:01 am
Location: Baar, Switzerland

Re: Veeam Backup v4 wait command

Veeam Logoby rogersillars » Mon Nov 09, 2009 7:05 pm

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
rogersillars
Enthusiast
 
Posts: 30
Liked: never
Joined: Tue Jun 23, 2009 10:48 pm
Full Name: Roger Sillars

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests