Start-VBRZip

PowerShell script exchange

Re: Start-VBRZip

Veeam Logoby NYTECJ » Sun Jun 23, 2013 1:21 am

Great. :D That can work. Is there a switch that allows the system to create separate .vbk files for each server with compression?
NYTECJ
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 15, 2011 3:40 pm

Re: Start-VBRZip

Veeam Logoby v.Eremin » Mon Jun 24, 2013 9:18 am 1 person likes this post

If you’re willing to get a seprate .vbk file for each VM, then you need to create a given number of different VeeamZIP jobs:

Code: Select all
asnp VeeamPSSnapin
$Server = Get-VBRServer -name "Name of your VC/ESX(i) host" | where {$_.type -eq "VC"}
$VMName = "Name of your VM”
$Entity = $Server | Find-VBRViEntity -name $VMName
Start-VBRZip -folder "Name of a folder you're going to backup VM to" -Entity $Entity 


You can choose different level of compression, using –compression parameter:

Code: Select all
Start-VBRZip -folder "Folder" -Compression *Number -Entity $Entity


*Number:

• 0 – None
• 4 – Dedupe-friendly
• 6 – Optimal (Recommended)
• 9 - Extreme


Hope this helps.
Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Start-VBRZip

Veeam Logoby NYTECJ » Tue Jun 25, 2013 4:12 pm

That works. Thank you very much.
NYTECJ
Novice
 
Posts: 4
Liked: never
Joined: Tue Nov 15, 2011 3:40 pm

Re: Start-VBRZip

Veeam Logoby v.Eremin » Wed Jun 26, 2013 8:04 am

You’re welcome. Should any additional help be needed, feel free to contact us. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Start-VBRZip

Veeam Logoby siddharth_k11 » Thu Jul 25, 2013 2:56 pm

Hi,

I am getting error in following script for taking backup of hyper-v vm

PS C:\Windows\system32> $Server = Get-VBRServer -name "Server01" | where {$_.type -eq "VC"}
PS C:\Windows\system32> $VMNames = "Test02"
PS C:\Windows\system32> Start-VBRZip -folder "D:\VeeamBKP" -Entity $Entity
Start-VBRZip : Cannot validate argument on parameter 'Entity'. The argument is null. Supply a non-null argument and try
the command again.
At line:1 char:41
+ Start-VBRZip -folder D:\VeeamBKP -Entity <<<< $Entity
+ CategoryInfo : InvalidData: (:) [Start-VBRZip], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Commands.Backup.StartVBRZip
siddharth_k11
Lurker
 
Posts: 1
Liked: never
Joined: Tue Apr 19, 2011 5:42 am
Full Name: Siddharth Kathe

Re: Start-VBRZip

Veeam Logoby ThomasMc » Thu Jul 25, 2013 4:53 pm

Code: Select all
$Entity = $Server | Find-VBRViEntity -name $VMName


Missing this
ThomasMc
Expert
 
Posts: 293
Liked: 17 times
Joined: Wed Apr 13, 2011 12:45 pm
Full Name: Thomas McConnell

Re: Start-VBRZip

Veeam Logoby greendx » Fri May 15, 2015 3:37 pm

Is there a way to specify a sub-folder within a repository when using VBRZip to backup to a repository?
greendx
Influencer
 
Posts: 13
Liked: never
Joined: Wed May 18, 2011 2:06 pm
Location: New York
Full Name: Eugene Lipsky

Re: Start-VBRZip

Veeam Logoby v.Eremin » Sat May 16, 2015 2:26 pm

In this case you should use -Folder parameter, instead of -Repository one. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Start-VBRZip

Veeam Logoby jim3cantos » Mon Sep 28, 2015 11:30 am

Hello,

after diving for a while in the forums I just wanted to share a ps1 script that uses Start-VBRZip to backup some vm's to a repository and then import the backup generated to veeam server. It includes tips from several threads and first part is only for running Start-VBRZip commands as administrator and avoid permission errors. Just fill appropriately the parameters between <>. For example, <UNC path to backup directory> is the full UNC path to repository directory from veeam backup server. Probably it can be optimized so feel free to do it.

Code: Select all
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
 
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
 
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
   {
   # We are running "as Administrator" - so change the title and background color to indicate this
   $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevated)"
   $Host.UI.RawUI.BackgroundColor = "DarkBlue"
   clear-host
   }
else
   {
   # We are not running "as Administrator" - so relaunch as administrator
   
   # Create a new process object that starts PowerShell
   $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
   
   # Specify the current script path and name as a parameter
   $newProcess.Arguments = $myInvocation.MyCommand.Definition;
   
   # Indicate that the process should be elevated
   $newProcess.Verb = "runas";
   
   # Start the new process
   [System.Diagnostics.Process]::Start($newProcess);
   
   # Exit from the current, unelevated, process
   exit
   }
 
# Run your code that needs to be elevated here
# Retention settings (Optional; By default, VeeamZIP files are not removed and kept in the specified location for an indefinite period of time.
# Possible values: Never , Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)
$Retention = "In1Month"
Add-PSSnapin -Name VeeamPSSnapIn
$Repository = Get-VBRBackupRepository -Name "<repository name>"
$Server = Get-VBRServer -name "<VC server>" | where {$_.type -eq "VC"}
$VMNames = "<vmname1>", "<vmname2>", "<vmname3>"
$Entity = $Server | Find-VBRViEntity -name $VMNames
$myZip = Start-VBRZip -BackupRepository $Repository -AutoDelete $Retention -Entity $Entity
############### Checking Result ###############
if(($myZip.Result -eq "Failed") -or $myZip.Result -eq "null")
{
   $myReturn = "FAILED"
}
else
{
   $LastVBK = Get-ChildItem "<UNC path to backup directory>" | where {$_.Extension -eq ".vib" -or $_.Extension -eq ".vbk"} | Sort-Object creationtime -Descending | select -First 1
   Import-VBRBackup –Server '<repository server>' –FileName $LastVBK.fullname
   $myReturn = $LastVBK.fullname

}
############### Return Filename or Returncode "FAILED" ###############
return $myReturn
jim3cantos
Enthusiast
 
Posts: 43
Liked: 5 times
Joined: Tue Jan 08, 2013 6:14 pm
Location: Madrid, Spain
Full Name: José Ignacio Martín Jiménez

Re: Start-VBRZip

Veeam Logoby Andreas Neufert » Mon Sep 28, 2015 11:37 am

Very cool,

thank you very much!
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Re: Start-VBRZip

Veeam Logoby v.Eremin » Mon Sep 28, 2015 3:08 pm

Why do you need to import newly created VeeamZIP file to a backup server? You're writing to a backup server, doesn't the newly created file get imported automatically, when a repository rescan takes place? Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Start-VBRZip

Veeam Logoby jim3cantos » Tue Sep 29, 2015 7:06 am

v.Eremin wrote:Why do you need to import newly created VeeamZIP file to a backup server? You're writing to a backup server, doesn't the newly created file get imported automatically, when a repository rescan takes place? Thanks.

Nope. I have tried both from powershell and the console and individual .vbk files are not imported. Doesn't have to be a backup set of files from another backup job to be able to import with repository rescanning?...in other threads and also in the help pages it seems to say so:
You may need to import backups to Veeam Backup & Replication in the following situations:

▪The Veeam backup server has failed and you have restored it in a new location. You want to restore VM data from backups created by the Veeam backup server that has failed.
▪You want to restore VM data from backups created on other Veeam backup servers.
▪You want to restore VM data from backups on the backup repository that is not connected to Veeam Backup & Replication (for example, if you removed it earlier).
You want to restore VM data from VeeamZIP files created on your Veeam backup server or other Veeam backup servers.

http://helpcenter.veeam.com/backup/80/v ... ckups.html
jim3cantos
Enthusiast
 
Posts: 43
Liked: 5 times
Joined: Tue Jan 08, 2013 6:14 pm
Location: Madrid, Spain
Full Name: José Ignacio Martín Jiménez

Re: Start-VBRZip

Veeam Logoby v.Eremin » Tue Sep 29, 2015 10:54 am

Yep, my bad. Backup files created by VeeamZIP don't have .vbm along with them, thus, cannot be imported automatically during repository rescan. So, the import portion of code is still required. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Start-VBRZip

Veeam Logoby Andreas Neufert » Wed Sep 30, 2015 10:28 am

Would be cool if we can add vbm file automaticall at one of the next versions.
This would also help to avoid problems when customers want to use Veeam-ZIP with Seeding
Andreas Neufert
Veeam Software
 
Posts: 2201
Liked: 360 times
Joined: Wed May 04, 2011 8:36 am
Location: Germany
Full Name: @AndyandtheVMs Veeam PM

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 2 guests