PowerShell script exchange
Post Reply
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Run veeam backups via CLI

Post by maverick964_uk »

I have veeam 6.5 and 30 jobs to run.

I wont bore you with the setup but what I need to do is run one job each day via some sort of command line interface.
The veeam scheduler is very basic so I will be using another scheduler to run the veeam jobs. :?

I believe it has to be done via powershell. Does anyone have examples of how to create and run the jobs via command line....

example job names:

WIN-DAY-1
WIN-DAY-2
WIN-DAY-3

etc...etc...

thanks :D
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

Your post has been moved to existing Powershell sub community. Kindly see the corresponding Beginners’ section that has extensive information regarding job creation/schedule, etc.

Hope this helps.
Thanks.
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

thanks. I now have powershell and will develop a script to execute...
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

If any additional questions arise, don't hesitate to let me know. Thanks.
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

I've now progressed so thank you so far....

I want to run a backup via powershell but I want realtime standard output from the job.

I perform this....

> get-vbrjob -name "testdata" | start-vbrjob -Fullbackup -Verbose

I dont seem to get much output ....

what would you suggest as I'm running these jobs from an enterprise backup tool so it will be handy to collate all the STDOUT.
Dont want errors, but also normal messages too.

thanks
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

I dont seem to get much output.

Honestly, it seems unlikely to me that you will be able to get a real-time statistics in PowerShell apart from very basic one. Also, it doesn’t matter what parameter you’re going to use –verbose or –debug one.

By “Basic statistics” I meant Backup job name, object number, bytes processed, time remaining, files remaining, avg. rate, and progress bar.
So,it will be handy to collate all the STDOUT.
In fact, I would argue that it’s that crucial to see an output for every particular job in your environment, especially, when there are a number of them. As long as everything works as expected, I don’t want to babysit each backup activity.

Thanks.
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

thanks for the information but unfortunately we need some sort of real-time stdout....

HP Data Protector is executing the powershell command and we want the output from the job...

I could capture the data from the job logfile in C:\programdata\veeam\backup ??
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

ok, if I let the job complete what powershell command can I use to get good detail about that job....

I need more than just a one line output....
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

What specific type of information you’re after? If you can shed a little bit more light, I will probably come up with the script example that might answer your requirements.

Anyway, as a first source of information I strongly recommend reviewing these topics:

PowerShell Report
Backup status report
List of Failed VMs

Thanks.
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

thanks for the reply and information.

I am looking for `get-vbrjob -name "testbackup"` and some options so that I get a good summary report of that previous backup job....

hope that helps...

Quick question, when is v7 available? Also which version of veeam 6 had major changes to the way the backup files are written. We believe "write in place" is used when veeam writes into the backup file....

Appreciate your help. thanks
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

Below there is a short list of settings I managed to recall. If something specific isn’t present there, please let me know and I will try to help you:

Code: Select all

asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your Job" 
$Job.info # Generic Job description.
$Job.GetOptions() # General Job options. Drill down and see more specific ones like .ViSourceOptions, etc.
$Job.ScheduleOptions # Job Schedule Options.
$Job.GetVssOptions() # VSS Options. Application Aware Image Proccesing, indexing, etc.
$Job.GetObjectsInJob() # Objects that are backed up within this job.
$Job.FindLastSession() # Last session details
Quick question, when is v7 available?
According to plan, Veeam Backup and Replication 7 will be released in Q3 this year.
Also which version of veeam 6 had major changes to the way the backup files are written.
It’s true that some changes were implemented in 6.x versions to the way the backup files are written. However, it’s not exactly clear what you meant by “write in place”. Could elaborate on it a little bit?

Hope this helps.
Thanks.
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

thanks for the reply. Would I just specify GetObjectsInJob or FindLastSession as a parameter on get-vbrjob ?

thanks about v7....are there any enhancements to scheduling? I see this as a flaw with veeam at 6.5 ....

We are doing backups to a HP D2D which does in-line dedup and replication. Veeam seems to create a "sparse" file and wizz around the file during backup. Writing an area then potentially writing over parts as it goes. This causes big problems with replication on the D2D. At present we are writing to local disk first then copying the data to the D2D fileshare after. Would be good to know more about vib and vbk file changes....thanks
tsightler
VP, Product Management
Posts: 6035
Liked: 2860 times
Joined: Jun 05, 2009 12:57 pm
Full Name: Tom Sightler
Contact:

Re: Run veeam backups via CLI

Post by tsightler »

maverick964_uk wrote:thanks about v7....are there any enhancements to scheduling? I see this as a flaw with veeam at 6.5 ....\
You should probably clarify what specifically you are looking for as simply calling it "basic" doesn't really give a clue and it works fine for 10's of thousands of customers.

Regarding WIP, Veeam certainly writes metadata to the backup file as part of the process, which of course overwrites exiting metadata as the file grows. This apparently causes some issues with the way HP D2D handles these writes. For now copy the files after the fact is the best workaround, in V7 a better option might be to use the HP D2D as a VTL.
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

FindLastSession is a parameter of job object and you can get it the following way:

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Job.FindLastSession()

Code: Select all

(Get-VBRJob -name "Name of your Job").FindLastSession
It can be neither changed nor specified, it just provides you with the information relevant to the latest session.

As to objects in job, they, in their turn, can be output in different ways:

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$Job.GetObjectsInJob()

Code: Select all

(Get-VBRJob -name "Name of your Job").GetObjectsInJob()

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
Get-VBRJobObject -Job $Job
Additionally, the objects in job can be added and deleted via PS.

Anyway, the best option you have, if you’re eager to find out parameters of corresponding object, is to run get-member command, which gives you information regarding properties and methods that are available to you.

Code: Select all

Get-VBRJob -name "Name of your Job" | Get-Member
Hope this helps.
Thanks.
maverick964_uk
Expert
Posts: 102
Liked: 3 times
Joined: May 09, 2013 8:57 am
Full Name: Mike Lavery
Contact:

Re: Run veeam backups via CLI

Post by maverick964_uk »

many thanks, will try that.

Also, we've created a new proxy with 24 cores and veeam seems to use all 24 cores. Is this normal?
Proxy is at 95% cpu utilisation....
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Run veeam backups via CLI

Post by veremin »

Proxy is at 95% cpu utilisation....
I would say that it’s something expected, taking into account on-the-fly data compression and deduplication.

Additionally, the upcoming release will implement the new default compression scheme that is optimized for low CPU usage; this is likely to bring dramatic improvements. So, stay tuned.

Anyway, if you’re willing to continue discussion about different things, please, create additional topic in order not to mess this up.

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests