PowerShell script exchange
Post Reply
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by PTide »

Azerty wrote:In fact, the script you gave me does not work.
What do you mean by "does not work"? Please elaborate on that. Have you searched for a solution in this thread?

Thanks
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

Hello
I solved my problem. :D
By updating the version of powershell (version 2 to 4)
Now it is good
Thank you for your help

Additional question: is it possible to have multiple recipients, I have not found how to do?
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

The answer to this question has been provided in this thread previously. Thanks.
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty » 1 person likes this post

Thank you
Now it's good to send to multiple recipients
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

You're welcome. Feel free to ask for additional clarification, should one be needed. Thanks.
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty » 2 people like this post

v.Eremin wrote:You're welcome. Feel free to ask for additional clarification, should one be needed. Thanks.
A big thank you for your work Vladimir. :wink:
It's very nice of you.
I put here some code that I have changed for formatting email.
To turn GREEN for backups with a SUCCESS result and RED for backups with a FAILED result.

Code: Select all

##################################################################
#                   Email formatting 
##################################################################

# SUCCESS
$styleSUCCESS = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$styleSUCCESS = $styleSUCCESS + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$styleSUCCESS = $styleSUCCESS + "TH{border: 1px solid black; background: #4CAF50; color: white; padding: 5px;}"
$styleSUCCESS = $styleSUCCESS + "TD{border: 1px solid black; padding: 5px;}"
$styleSUCCESS = $styleSUCCESS + "</style>"

# FAILED
$styleFAILED = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$styleFAILED = $styleFAILED + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$styleFAILED = $styleFAILED + "TH{border: 1px solid black; background: #FB5A5A; color: white; padding: 5px;}"
$styleFAILED = $styleFAILED + "TD{border: 1px solid black; padding: 5px;}"
$styleFAILED = $styleFAILED + "</style>"


##################################################################
#                   End User Defined Variables
##################################################################

#################### DO NOT MODIFY PAST THIS LINE ################
Asnp VeeamPSSnapin

[...]

 If ($EnableNotification) 
  {
    $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
    $FailedSessions =  $TaskSessions | where {$_.status -eq "EWarning" -or $_.Status -eq "EFailed"} 
  if ($FailedSessions -ne $Null)
  {
    $EmailTo = $EmailToSUCCESS , $EmailToFAILED
    $EmailSubject = $EmailSubjectFAILED
    $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={$FailedSessions.Title}})
    $style = $styleFAILED
   } 
  Else
  {
    $EmailTo = $EmailToSUCCESS
    $EmailSubject = $EmailSubjectSUCCESS
    $MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={($TaskSessions | sort creationtime -Descending | select -first 1).Title}})
    $style = $styleSUCCESS
  }
  }
}
  If ($EnableNotification)
  {
    foreach ($EmailTo in $EmailTo)
    {
      $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
      $Message.Subject = $EmailSubject
      $Message.IsBodyHTML = $True
      $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
      $SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
      $SMTP.Send($Message)
    }
  }
I have two questions about the retention settings.

- How many days is "in1week" 6 or 7 days?

- If a backup is made every Sunday with a retention time of "in1month" how many backups should be done before it is removed? 4 or 5? Is it depends on the month?

Thank you for your answers.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

From the top of my head:
- How many days is "in1week" 6 or 7 days?
7 days.
- If a backup is made every Sunday with a retention time of "in1month" how many backups should be done before it is removed? 4 or 5? Is it depends on the month?
The number of backup cycle is irrelevant here. A backup will be deleted in 30 days regardless of how many backup cycles have occurred since the time it was created.

Thanks.
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

v.Eremin wrote:The number of backup cycle is irrelevant here. A backup will be deleted in 30 days regardless of how many backup cycles have occurred since the time it was created.
Thank you for return.
It is still important in terms of storage space.
If a backup 100 GB is made every Sunday and if retention is "in1month", then it will take a maximum of 500 GB of storage space for an uncompressed backup.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Correct, I was just trying to point out that VeeamZIP backups in contrast to ordinary ones don't have point-based retention - a backup will expire regardless of current number of restore points. Thanks.
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

Thank you
This is what I understand
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

Another question. This time on the compression level

Which on average is the compression percentage:
- Level 5
- Level 6

Thank you
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Depends on how well source data can be compressed. Typically, level 6 gives 10% over level 5 at the price of higher CPU load. Thanks
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

OK
I have calculated that the level 5 provides approximately a 20%
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Which means that pattern of your source data might not be that suitable for data reduction.

On average we see about 50% of overall data reduction with default settings (deduplication + optimal compression).

Thanks.
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

v.Eremin wrote:Which means that pattern of your source data might not be that suitable for data reduction.

On average we see about 50% of overall data reduction with default settings (deduplication + optimal compression).

Thanks.
The test was done on a domain controller server on a test esxi.
I recheck the information Monday and I give you details.
Have a nice week end
silver_2000
Lurker
Posts: 1
Liked: never
Joined: May 29, 2016 1:51 pm
Full Name: Doug
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by silver_2000 »

This may have been covered but there are so many circular links pointing back here Im lost

The script works as long as I dont enable email
When I enable email I get a series of errors starting with this

Code: Select all

New-Object : Exception calling ".ctor" with "2" argument(s): "Value cannot be null.
Parameter name: from"

At C:\Users\administrator.xxx\Documents\veeamzip.ps1:109 char:12
+ $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
+            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationEx 
   ception
    + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell. 
   Commands.NewObjectCommand
 
The property 'Subject' cannot be found on this object. Verify that the property 
exists and can be set.
Any help would be appreciated
PTide
Product Manager
Posts: 6408
Liked: 724 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by PTide »

Hi,
When I enable email I get a series of errors starting with this
What are the values of $EnableNotification, $SMTPServer, $EmailFrom, $EmailTo, $EmailSubject variables?

Thanks
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

v.Eremin wrote:Which means that pattern of your source data might not be that suitable for data reduction.
On average we see about 50% of overall data reduction with default settings (deduplication + optimal compression).
Thanks.
Azerty wrote:The test was done on a domain controller server on a test esxi.
I recheck the information Monday and I give you details.
Have a nice week end
I bring you the results of the backup on my test server.
- Server saved: Domain Controller Windows 2003 R2 with user data.
- Duration 5:24:53
- Data read 558.0 GB
- Transferred 507.2 GB
- Backup size 500.7 GB
- Dedupe 1.9x
- 1.1x Compression
- Compression mode: Level 5

I do not find these very good results
I am far from an overall reduction in data with default settings 50% (+ deduplication optimal compression).

Is this normal ?
What to do to improve compression and backup time ?
Does he have something to do at the deduplication ?
What will happen if the backup is not completed overnight, and that users are working on the network ?

I'm worried
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Kindly, create a separate topic in general forum and provide your questions there, because they are not related to the given script and being put here they overfill the existing discussion with not related matter.

Thank you for understanding.
Azerty
Influencer
Posts: 15
Liked: 3 times
Joined: May 19, 2016 12:23 pm
Full Name: Azerty
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by Azerty »

v.Eremin wrote:Kindly, create a separate topic in general forum and provide your questions there, because they are not related to the given script and being put here they overfill the existing discussion with not related matter.

Thank you for understanding.
Yes
Sorry for the inconvenience
But I use the free version.
Thanks anyway.
MrJH
Influencer
Posts: 14
Liked: 2 times
Joined: Aug 18, 2015 2:01 pm
Contact:

[MERGED] Veeam encrypted backups failing

Post by MrJH »

Noticed that the B&R console showed failures, for a group of 4 VMs backed up via PowerShell. The first backup is successful, but the 2nd and remaining VMs fail.

PowerShell script displayed this - https://disqus.com/by/disqus_lNJp0VFoxQ/
Moans about cat : Cannot find drive. A drive with the name 'ID' does not exist

I can't see what has changed on the server that the PS script is run from, up to a couple of days ago everything was fine.

B&R is installed to a Server 2012 box.

Any ideas, anyone?

Many thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

But I use the free version.
Product edition doesn't matter in this case. So, kindly, follow my advice. Thanks.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Any ideas, anyone?
You $EncryptionKey variable doesn't appear to contain anything, so I wonder whether you;ve followed steps mentioned in "Encryption" chapter of the original blog post, such as creating secure string, etc.? Thanks.
ciambell3
Lurker
Posts: 2
Liked: never
Joined: Jun 08, 2016 10:42 am
Full Name: Matteo D'Andrea
Contact:

[MERGED] : Script Restore (After VeeamZIP (HV - updated))

Post by ciambell3 »

Hello boys,
I've tested with success the script VeeamZIP (HV - updated) of Vladimir Eremin. Now the question is How I can restore the VM with powershell?
I would like to use Start-VBRHvRestoreVM, but i cannot found Get-VBRRestorePoint from backup file that I've created from the script before.
https://helpcenter.veeam.com/backup/pow ... orevm.html
Can you help me?
Regards.
Thanks in advantage.
Matteo
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Hi, Matteo,

I'm wondering whether you're using free or paid product edition.

Thanks.
ciambell3
Lurker
Posts: 2
Liked: never
Joined: Jun 08, 2016 10:42 am
Full Name: Matteo D'Andrea
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by ciambell3 »

Hello,
I'm working with free edition.
Regards.
navs
Novice
Posts: 7
Liked: never
Joined: Jun 22, 2016 8:16 am
Full Name: Nav Sangha
Contact:

[MERGED] Veeam auto backup scripts

Post by navs »

Hi, I was looking into a script to auto backup my VMs in Hyper-V and came across this article https://www.veeam.com/blog/veeam-backup ... shell.html. However i am having some issues, i am running Veeam B&R 9.0.0.1491 [update 1]. I think article is written for Veeam 8 update 2. Is it meant to run OK in Veeam 9. I have filled out the below in the script. Any help appreciated.
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

I haven't tested my code against version 9. However, I strongly believe it should work smoothly, because otherwise I would have got a lot of complains, providing the number of users actively leveraging it. Thanks.
navs
Novice
Posts: 7
Liked: never
Joined: Jun 22, 2016 8:16 am
Full Name: Nav Sangha
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by navs »

Hi, i am getting the below error when i run the script, anything you can spot i am doing wrong?

Code: Select all

Find-VBRHvEntity : Cannot validate argument on parameter 'Server'. The argument is null. 
Provide a valid value for the argument, and then try running the command again.
At D:\batchfiles\VeeamZIPnew_noemail.ps1:76 char:48
+   $VM = Find-VBRHvEntity -Name $VMName -Server $Server
+                                                ~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Find-VBRHvEntity], ParameterBindingValidati 
   onException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Comm 
   and.FindVBRHvEntity

Code: Select all

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 D:\batchfiles\VeeamZIPnew_noemail.ps1:86 char:40
+     $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+                                        ~~~
    + CategoryInfo          : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationEx 
   ception
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Comm 
   ands.Backup.StartVBRZip
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Start-VBRZip in Veeam Backup Free Edition

Post by veremin »

Is the corresponding Hyper-V server added to a backup console? Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests