As you might be aware Veeam has released Update 2 for it’s Backup and Replication software. With that comes a slew of updates, integration with Endpoint Backup, vSphere 6 support, features, enhancements, bug fixes – you know the usual suspects that you might find inside of an update pack – you can see them all in the release notes here. Speaking of release notes – it’s always a good idea to read completely through them before even considering an upgrade – not just to find any known problems or gotchya’s, but at times, mostly all the time you will find a feature or change to the product that isn’t marketed and publisized as much as the rest. Now Veeam B&R update 2 is largely about Endpoint Backup integration and support for vSphere 6.0 –which is awesome – but as I was doing my once over of the release notes I noticed this….
Veeam has a long history of releasing so-called Freemium products – giving a way a scaled back portion of their complete solution absolutely free, while offering a paid license for those looking for enterprise features. Veeam Backup Free Edition is exactly this – allowing administrators to create full backups of their VMs using VeeamZip technologies – absolutely free.
The one caveat to this was you were never able to schedule your VeeamZips – so creating a backup was something that had to be manually triggered. I’m sure many of you (as have I) have tried – only to see the infamous “License is not installed” message when running the Start-VBRZip PowerShell cmdlet. Well, as of update 2 you can kiss that message goodbye and begin scheduling that cmdlet to your hearts delight.
Start-VBRZip
This is a relatively easy process but in the interest of completeness let’s go over it anyways. First up we need to create a PowerShell script that will execute the Start-VBRZip cmdlet, which inturn VeeamZips our VM. The script I used is below…
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
Param( [Parameter(Mandatory=$true)][string]$VM, [Parameter(Mandatory=$true)][string]$Destination, [Parameter(Mandatory=$true)][ValidateSet(0,4,5,6,9)][int]$Compression, [bool]$DisableQuiesce=$true, [Parameter(Mandatory=$true)][ValidateSet("Never","Tonight","TomorrowNight","In3days","In1Week","In2Weeks","In1Month")][string]$Autodelete ) #Load Veeam Toolkit & "C:\Program Files\Veeam\Backup and Replication\Backup\Initialize-VeeamToolkit.ps1" #Validate any parameters $vmentity = Find-VBRViEntity -Name $VM if ($vmentity -eq $null) { Write-Host "VM: $VM not found" -ForegroundColor "red" exit } if (-Not (Test-Path $Destination)) { Write-Host "Destination: $vmname not valid" -ForegroundColor "red" exit } if ($DisableQuiesce -eq $true) { Start-VBRZip -Entity $vmentity -Folder $destination -Compression $Compression -AutoDelete $Autodelete -DisableQuiesce } else { Start-VBRZip -Entity $vmentity -Folder $destination -Compression $Compression -AutoDelete $Autodelete } |
A couple things about the script – you can see that it takes 5 parameters; the VM to backup, the destination to back it up to, the level of compressions to apply, whether or not to queiesce the VM and the auto-delete policy to apply to the backup. From there we simply load the Veeam toolkit, do a little error checking and then initiate the backup with Start-VBRZip. Pretty simple stuff – you can go ahead and try it by saving the script and calling it like so…
VeeamZip.ps1 –VM “VM1” –Destination “E:\backups” –AutoDelete “Never” –Compression 5 –DisableQuiesce $false
Scheduling the script
Pick your poison when it comes to scheduling this script to run – I’ve chose the standard Windows Task Scheduler to do the job. So go ahead and create a scheduled task with whatever schedule you like within Windows – The only really tricky part is passing the arguments to the script – the way I have done it is by selecting ‘Start a program’ as my action, passing the path to PowerShell.exe in my program script, then enclosing my string arguments in single quotes, and the complete arguments string in double quotes like below
Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Add arguments: “c:\VeeamZip.ps1 –VM ‘VM1’ –Destination ‘E:\backups’ –AutoDelete ‘Never’ –Compression 5 –DisableQuiesce $false”
From there it’s a matter of creating as many scheduled tasks as you have VMs you want backed up, or modifying the script to backup all your VMs – Either way, as you can see, the Veeam Backup Free edition has received a nice little feature buried within the Update 2 release notes!!!!
Hallo i have a little Problem with you script. I always get the error Message: 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.
I took the Name of the VM that i see in the hyper-v manager under Virtual mashines an took one of these. Is this the wrong name ?
Thanks for your help Stephan
Hi Stephan – thanks for the comment…
The script has been written with vSphere in mind but can easily be modified to support Hyper-V…
Line 11 which reads
$vmentity = Find-VBRViEntity -Name $VM
could essentially be switched to support the Hyper-V entity by replacing it with
$vmentity = Find-VBRHvEntity -Name $VM
Easy as that – should go for you after switching…
Thanks,
Mike
Hi!
I’ve a problem about Update 2 and VBRZip use.
When I try to execute the script, I receive always this error:
Start-VBRZip : License is not installed.
At C:VeeamZIPStartZip.ps1:24 char:5
+ Start-VBRZip -Entity $vmentity -Folder $destination -Compression $Compressio …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Start-VBRZip], CLicenseNotInstalledException
+ FullyQualifiedErrorId: Veeam.Backup.LicenseLib.CLicenseNotInstalledException,Veeam.Backup.PowerShell.Commands.
I’ve installed Update 2 last week, but it seems to not working.
Do you have some advice?
Thanks in advance.
Same problem here, running Backup 8 Free with Update 2:
Start-VBRZip : License is not installed.
At C:scriptstest.ps1:24 char:17
+ Start-VBRZip <<<< -Entity $vmentity -Folder $destination -Compression $C
ompression -AutoDelete $Autodelete -DisableQuiesce
+ CategoryInfo : NotSpecified: (:) [Start-VBRZip], CLicenseNotIns
talledException
+ FullyQualifiedErrorId : Veeam.Backup.LicenseLib.CLicenseNotInstalledExce
ption,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip
Same here, running Veeam Backup & Replication Ver 8.0.0.817
We’re idiots. See http://www.veeam.com/updates.html for the required “additional” update 2b…
Ha Ha I was coming back here to say the same thing! Update 2b fixes the license issue for sure.
i have update 3 and the licence issue seems to still be present? anyone else?
Hmm, was there an option to install powershell components as well with Update 2 – wondering if maybe they didn’t get upgraded as it has all worked from my end…
No idea. I’m using your interactive script via powershell, but when I put all the requested parameters, after a few seconds I receive this error.
I’ve the 8.0.0.2021 release, so I think the Update 2 has correctly installed.
Ok, found the problem. I was not using the Veeam Powershell in order to test your script. Now, using the Powershell inside Veeam menu, appears to work.
Thanks.
Should line 12 (if ($vm -eq $null)) not be: if ($vmentity -eq $null) ???
However the Find-VBRViEntity -Name “HyperV-VM” is not returning any entity ???
You have to update the command to Find-VBRHvEntity.
The commands are Virtualisation platform specific.
Maybe I’m just a moron, I know very little about powershell. I’m trying to run this script but there’s something wrong with what I’m doing.
My destination is a nested folder on a network share that works when I run the backups from the GUI, but is failing when it is the destination of the script.
6/11/2015 11:09:56 AM :: Error: Access is denied.
Cannot create folder. Folder path: [\serversharethursday].
–tr:FC: Failed to create directory. Directory path: [\serversharethursday].
–tr:Failed to call DoRpc. CmdName: [FcCreateDir].
Access is denied.
Cannot create folder. Folder path: [\serversharethursday].
This folder already exists, and again works fine when targeted within the GUI. Any advice?
I had the same problem. I’m not sure, but I do belive that it is the local service (not your user-account) who runs the zip-backup and that’s why there i no access to network-share. I solved this by setting up a share without password-requirements (in DMZ of cource).
This script is for VMware ONLY! To make it work with Hyper-V change ”
Find-VBRViEntity” on line 11 to “Find-VBRHvEntity”
I’m running Veeam FREE edition with Update 2b (8.0.0.2030) on Windows 2012 R2 64bit and I still get the error of “Start-VBZip: Veeam Backup Free Edition does not allow VeeamZIP of multiple VMs. Specify a single VM, or install a paid product license.” Anyone know how to fix this?
So apparently backing up the Virtual Center VM throws that error message, is there any way around it? I’m able to backup all other VMs without any problem.
Anyone find a solution to this?
I could not get this to work. Simply running “PS C:Program FilesVeeamBackup and ReplicationBackup> .Initialize-VeeamToolkit.ps1” produces this
Exception calling “GetAssemblyName” with “1” argument(s): “Could not load file or assembly
‘Veeam.Backup.PowerShell.dll’ or one of its dependencies. The system cannot find the file specified.”
At C:Program FilesVeeamBackup and ReplicationBackupInitialize-VeeamToolkit.ps1:13 char:2
+ $arch = [reflection.assemblyname]::GetAssemblyName($currentExecutingPath).Proce …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileNotFoundException
Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 3.
At C:Program FilesVeeamBackup and ReplicationBackupInitialize-VeeamToolkit.ps1:137 char:1
+ Add-PSSnapin VeeamPSSnapIn
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (VeeamPSSnapIn:String) [Add-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
Get-PSSnapIn : No Windows PowerShell snap-ins matching the pattern ‘VeeamPSSnapIn’ were found. Check the pattern and
then try the command again.
At C:Program FilesVeeamBackup and ReplicationBackupInitialize-VeeamToolkit.ps1:140 char:11
+ $snapIn = Get-PSSnapIn “VeeamPSSnapIn”
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (VeeamPSSnapIn:String) [Get-PSSnapin], PSArgumentException
+ FullyQualifiedErrorId : NoPSSnapInsFound,Microsoft.PowerShell.Commands.GetPSSnapinCommand
update-formatdata : Cannot find path ‘C:Program FilesVeeamBackup and
ReplicationBackupVeeam.Backup.PowerShell.format.ps1xml’ because it does not exist.
At C:Program FilesVeeamBackup and ReplicationBackupInitialize-VeeamToolkit.ps1:142 char:1
+ update-formatdata -prependPath $xmlFilePath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Veeam.Backup.PowerShell.format.ps1xml:String) [Update-FormatData], It
emNotFoundException
+ FullyQualifiedErrorId : FormatPrependPathException,Microsoft.PowerShell.Commands.UpdateFormatDataCommand
I have installed PowerShell 3.0 and Update 2b and there simply isn’t a “Veeam.Backup.PowerShell.dll” installed on my Win 2008 R2 server
I think I have fixed this you need to install “VeeamBackup&Replication.8.0.0.817BackupBPS_x64,msi”
Is there any way to backup all VM’s rather than specifying a specific VM ? I can create multiple scheduled jobs specifying each VM but would be nice if it automatically backed up VM’s that had been created on the host. Just about to have a look at the Veeamtoolkit.ps1 file to see what it does….
(get-vm -ComputerName YOURSERVERFQDN | foreach { $_.Name }) -join “
",
“” | Tee-Object -Variable VMNames | Out-Null$VMNames = “
"" + $VMNames + "
“”Great Script, just have one question. I have tried to add multiple email addresses by using “job.bloggs@abc.com”,”john.doe@here.com”…. however only the first recipient is getting the mail. Am I doing something wrong?
TIP: If you just want to backup ALL your machines without giving names, use this instead of $VMNAMES= “A”,”B”,”C”
(get-vm -ComputerName YOURSERVERFQDN | foreach { $_.Name }) -join “
",
“” | Tee-Object -Variable VMNames | Out-Null$VMNames = “
"" + $VMNames + "
“”That’s exactly what I want, but I have no experience with powershell. Where do you put this? I suppose it has to go into some loop?
To be honest after messing about with various backup scripts and powershell, PowerCli, etc this is the most straightforward and logical solution. Nice one Cheers
Thanks! I’m working on an update to this – more of a way to call it through other means so stay tuned!
question… what version of Veeam B&R are you running to do this I have been trying and it will not backup with version 8
Tetzschner is correct. This script currently only works with VMWare. and line 12 should read as he listed.
Starting with the corrected line 12 and ending with line 13 add the below to make this work with VMWare and Hyper-V
if ($vmentity -eq $null)
{
$vmentity = Find-VBRHvEntity -Name $VM
}
if ($vmentity -eq $null)
{
Write-Host “VM: $VM not found” -ForegroundColor “red”
exit
}
Thanks everyone for working this out – I’ve updated the post with your changes 🙂
Thanks for this correction!
For the life of me I cannot get the script to save to a UNC path.
[03.03.2016 13:29:26] Error Access is denied. in c++: Error code: 0x00000005
[03.03.2016 13:29:26] Error in c++: Failed to open storage for read/write access. Storage: [\ServerBackupsTech2016-03-03T132919.vbk].
[03.03.2016 13:29:26] Error in c++: Failed to upgrade/fix the storage [\ServerBackupsTech2016-03-03T132919.vbk].
[03.03.2016 13:29:26] Error in c++: Client failed to process the command. Command: [prepStorageForWriteEx].
[03.03.2016 13:29:26] Error in c++ event: ClientErrorEvt
With the GUI, the credentials is stored & associated with the relevant share, though does not even help after a successful manual backup.
Is there a way to specify the credentials of the share within the script ?
So i got this working via GMAIL and wanted to share, but also I’m confused on my issue. So at the very end I added these parameters below. So now my script sends the email to and from and subject are all there…..BUT the body with the results is totally blank. any thoughts??????????
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTPClient = New-Object Net.Mail.smtpclient($smtpserver, 587)
$SMTPClient.EnableSsl = $True
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential(“email@mydomain.com”,”password”);
$SMTPClient.Send($EmailFrom,$EmailTo,$EmailSubject,$MessagyBody)
I’m trying to use this script to run a scheduled backup to a NAS but I am getting an access denied error message, backing up to C: works with no problem, the logged in user can browse the mapped drive or the UNC path which is located on the NAS, either way specified in the script does not work and returns the following error; “The system cannot find the path specified. Failed to create or open file Z:[backup-filename].vbk”
I tried setting the service to run as the logged in user that has access to the share but no joy, any ideas?
How can you make this script work (send mail report) only in case of failures
-disableQuesqing $ string does not work, it gives an error. + when start the script without it kicks off, but it stops…and why? nobody knows…
PS C:UsersAdministrator> C:WindowsSystem32WindowsPowerShellv1.0powershell.exe “c:scriptveeam.ps1 -VM ‘W10-Leon-
Normal’ -Destination ‘z:w10leon’ -AutoDelete ‘Never’ -Compression 5”
Welcome to the Veeam Backup and Replication PowerShell Toolkit!
To list available commands, type Get-VBRCommand
To open online documentation on all available commands, type Get-VBRToolkitDocumentation
Copyright © Veeam Software AG. All rights reserved.
Job Name State Start Time End Time Result
——– —– ———- ——– ——
W10-Leon-Normal_2… Stopped 31-8-2016 13:20:54 31-8-2016 13:21:09 Failed
for further queries related to windows 10 technical support contact us on our website http://www.windows10-support-number.com/windows10-technical-support.html
Dear Geeks,
Greetings,
I have tried the above script to schedule VM backup from my
ESXI host its working perfectly.
But what I need to do right now is any possible options is
there to take the back of VM snapshot automatically using Veeam free edition of
backup and replication?
If it is not possible can you, please let me know
Is there any other script is there to take the snapshot of VM
hosted in ESXI automatically and storing inside the ESXI data store or any
external storage device?
Thanks in Advance
Regards
Devaraj