Start-VBRZip in Veeam Backup Free Edition

PowerShell script exchange

Start-VBRZip in Veeam Backup Free Edition

Veeam Logoby Rick.Vanover » Mon May 11, 2015 10:51 am 4 people like this post

I just posted the blog post from Vladimir about Update 2 brining PowerShell support:

http://www.veeam.com/blog/veeam-backup- ... shell.html

It's better if any discussions for the script are here rather than blog comments, so let's get scripting!
Rick.Vanover
Veeam Software
 
Posts: 314
Liked: 74 times
Joined: Tue Nov 30, 2010 3:19 pm
Location: Columbus, Ohio USA
Full Name: Rick Vanover

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby cowboy6 » Tue May 12, 2015 12:11 pm

Great post/news about this new feature. I'm having some trouble with script from here: http://www.veeam.com/blog/wp-content/up ... eamZIP.zip

I get this error:



Find-VBRViEntity : Unable to cast object of type 'Veeam.Backup.Core.Infrastructure.CHvHostItem' to type 'Veeam.Backup.Core.Infrastructure.IViI
tem'.
At C:\scripts\backup_hyperv.ps1:78 char:9
+ $VM = Find-VBRViEntity -Name $VMName -Server $Server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Find-VBRViEntity], InvalidCastException
+ FullyQualifiedErrorId : System.InvalidCastException,Veeam.Backup.PowerShell.Command.FindVBRViEntity

cowboy6
Lurker
 
Posts: 1
Liked: never
Joined: Tue May 12, 2015 12:02 pm
Full Name: Gregor Godler

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby v.Eremin » Tue May 12, 2015 10:43 pm 1 person likes this post

It seems that you're using HV infrastructure, right? The script has been developed to vSphere deployment, so some of the lines need to be replaced with HV alternatives to make the script work.

We will provide HV version and attach it to the blog post soon.

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

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby v.Eremin » Wed May 13, 2015 2:14 pm 1 person likes this post

Basically, you need to replace Find-VBRViEntity with its HV analogue - Find-VBRHvEntity. Thanks.
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby bobendicott » Wed May 13, 2015 6:32 pm 1 person likes this post

I have tried to implement this script and it works great for a single VM but if I try to add multiple VM's to the script I receive the errors below.

Here is what I am putting in the VMName section of the script
# Names of VMs to backup separated by semicolon (Mandatory)
$VMNames = "VM1; VM2; VM3"

Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Provide a valid value for the
argument, and then try running the command again.
At C:\scripts\VeeamZIP.ps1:86 char:40
+ $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+ ~~~
+ CategoryInfo : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip

You cannot call a method on a null-valued expression.
At C:\scripts\VeeamZIP.ps1:91 char:5
+ $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull

thank you.
bobendicott
Lurker
 
Posts: 1
Liked: 1 time
Joined: Mon Jan 05, 2015 1:18 am
Full Name: Bob Endicott

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby v.Eremin » Sat May 16, 2015 2:30 pm 1 person likes this post

What happens if you try to separate them in the similar manner:

Code: Select all
$VMNames = "VM1", "VM2", "VM3"
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby gzartman » Sun May 17, 2015 5:54 am

bobendicott wrote:I have tried to implement this script and it works great for a single VM but if I try to add multiple VM's to the script I receive the errors below.
.


I ran into the same issue with this powershell script. I am not super familiar with PS scripts, but all that $VMNames is doing is storing a list of VM names. I don't think that putting semi-colons inside the quotes is proper list syntax. Instead, the following syntax will work: $VMNames = "VM1","VM2"

In other words, VM names inside quotes separated by commas.

This has been testing on my machine and now the script works fine for multiple VMs.

Greg
gzartman
Lurker
 
Posts: 1
Liked: never
Joined: Sun May 17, 2015 5:38 am
Full Name: Greg Zartman

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby v.Eremin » Mon May 18, 2015 10:44 am 1 person likes this post

It should work with commas, indeed.

I'm now preparing list of modifications, and will ask Rick to upload them to the blog post later on.

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

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby Rick.Vanover » Mon May 18, 2015 4:09 pm 1 person likes this post

Rick.Vanover
Veeam Software
 
Posts: 314
Liked: 74 times
Joined: Tue Nov 30, 2010 3:19 pm
Location: Columbus, Ohio USA
Full Name: Rick Vanover

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby CTRidgeline » Mon May 18, 2015 5:47 pm

Good afternoon,

I have the script setup and it runs quite well, with the exception of the following err and nothing reported in the Details section of the email being sent. Any suggestions? I tried this with 1 server and 3 servers being backed up with the script and get the message for each server.

You cannot call a method on a null-valued expression.
At C:\Users\xxxxxxxx\Desktop\veeamzip-TEST.ps1:91 char:64
+ $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog <<<< ().updatedrecords
+ CategoryInfo : InvalidOperation: (getlog:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull


Thank you for your assistance.
CTRidgeline
Novice
 
Posts: 7
Liked: 1 time
Joined: Wed May 13, 2015 12:52 pm

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby CTRidgeline » Mon May 18, 2015 6:06 pm

Sorry, I have question on this...

Is there a method for sending the email to multiple recipients? I tested it with two email addresses either as "1st@test.com;2nd@test.com" and "1st@test.com","2nd@test.com" and it appears that only the first email gets sent to the first address when it is together with the single set of quotes and sent to the last entry on the individual addresses with the quotes and comma.
Thanks!
CTRidgeline
Novice
 
Posts: 7
Liked: 1 time
Joined: Wed May 13, 2015 12:52 pm

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby v.Eremin » Tue May 19, 2015 10:13 am

You cannot call a method on a null-valued expression.

It appears that $ZIPSession variable doesn't contain anything, may be VeeamZIP has been started against non-existent VM or something.

Is there a method for sending the email to multiple recipients?

I think you can create a list of recipients and, then, add a loop at e-mail sending stage, so that, email will be generated for multiple addresses.

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

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby CTRidgeline » Tue May 19, 2015 11:51 am

v.Eremin wrote:
You cannot call a method on a null-valued expression.

It appears that $ZIPSession variable doesn't contain anything, may be VeeamZIP has been started against non-existent VM or something.

The backup is running successfully and I can get the report emailed to me, but as you can see in the email report sample below (although it doesn't align right, there is another section at the end of each line for 'Details'), the detail is blank and I think this is tied back to the error that is being generated. I just can't figure why it is coming back as a null value.
Name Start TimeEnd Time ResultDetails
SERVER1_2015-05-18T172527 5/18/2015 5:25:27 PM5/18/2015 5:36:28 PMSuccess
SERVER2_2015-05-18T173633 5/18/2015 5:36:33 PM5/18/2015 5:58:17 PMSuccess
SERVER3_2015-05-18T175820 5/18/2015 5:58:20 PM5/18/2015 6:16:38 PMSuccess


v.Eremin wrote:
Is there a method for sending the email to multiple recipients?

I think you can create a list of recipients and, then, add a loop at e-mail sending stage, so that, email will be generated for multiple addresses.

Thanks.


OK, I will have to give that a try. Thanks for the pointers. :wink:
CTRidgeline
Novice
 
Posts: 7
Liked: 1 time
Joined: Wed May 13, 2015 12:52 pm

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby v.Eremin » Tue May 19, 2015 12:27 pm

"Details" is blank due to $ZIPSession variable being indicated as null. Though, I'm not sure how it happens because $ZIPSession variable is used multiple times to get session specific information, such as start time, end time, etc (and those are reflected correctly).
v.Eremin
Veeam Software
 
Posts: 13296
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Discussion on blog post: Update 2 featuring PowerShell

Veeam Logoby CTRidgeline » Tue May 19, 2015 12:31 pm

v.Eremin wrote:"Details" is blank due to $ZIPSession variable being indicated as null. Though, I'm not sure how it happens because $ZIPSession variable is used multiple times to get session specific information, such as start time, end time, etc (and those are reflected correctly).


Yup, that is pretty much what my thoughts were, that it is correctly using the $ZIPSession variable to gather the start/end/status but seems to have an issue getting the detail.
CTRidgeline
Novice
 
Posts: 7
Liked: 1 time
Joined: Wed May 13, 2015 12:52 pm

Next

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 6 guests