backup single VM (not all VMs) within job?

PowerShell script exchange

Re: backup single VM (not all VMs) within job?

Veeam Logoby Vitaliy S. » Thu Mar 02, 2017 12:43 pm

Yes, this makes total sense and is already acknowledged as an important feature > Backup VM within a Job - especially SQL?
Vitaliy S.
Veeam Software
 
Posts: 20957
Liked: 1245 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: backup single VM (not all VMs) within job?

Veeam Logoby stephen.loera » Mon Dec 04, 2017 11:19 pm

Any chance that this will be a feature in Update 3?

I know that "Quick Backup" is an option but that only works if there is an existing full backup. If I add a new VM to backup, I would like to be able to kick off a "full" backup on that newly added VM without the need to run the eintire job on all the VMs.
stephen.loera
Service Provider
 
Posts: 25
Liked: 4 times
Joined: Wed May 11, 2016 4:59 am
Full Name: Stephen Loera

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Tue Dec 05, 2017 1:48 pm

Any chance that this will be a feature in Update 3?

Update 3 does not have this feature implemented. So, for now the scripts and Quick Backup (for cases where full backup is there) are the only options. Thanks.
v.Eremin
Veeam Software
 
Posts: 14701
Liked: 1100 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Backup only one VM within a job with powershell

Veeam Logoby Dani » Wed Dec 06, 2017 1:55 pm

Hello

We have a backup job configured to backup all vms on a specific volume.

Virtual machines to backup: "cluster shared volume 01"
Runtime: every day at 10PM.

Additionally, we want to run a backup of one VM whithin this volume every 2 hours from 8AM to 6PM.

What would be the best way to do that?
Would it be possible with a powershell script?
If yes, how?

Thanks,
Daniel
Dani
Novice
 
Posts: 5
Liked: never
Joined: Thu Mar 12, 2015 11:44 am
Full Name: Daniel

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Wed Dec 06, 2017 2:46 pm

Your post has been merged into existing discussion talking about similar matter. Please, check the answers provided above. Thanks.
v.Eremin
Veeam Software
 
Posts: 14701
Liked: 1100 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: backup single VM (not all VMs) within job?

Veeam Logoby t481 » Thu Feb 08, 2018 11:51 am

hi Veeam engineers,
Surely this is an indication that there is a requirement for this feature to be implemented. I'm having the same issue whereby I need to manually backup individual VMs that have just been added to a job and I need to test how this would work within the same job. I could create a separate backup job to test the backup but I don't see why such a simple feature hasn't been added especially since it's been present in legacy backup software for as long as I can remember!
t481
Enthusiast
 
Posts: 41
Liked: never
Joined: Tue Apr 28, 2015 7:52 am

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Thu Feb 08, 2018 11:56 am

Isn't Quick Backup something you're looking for? Thanks.
v.Eremin
Veeam Software
 
Posts: 14701
Liked: 1100 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: backup single VM (not all VMs) within job?

Veeam Logoby t481 » Mon Feb 26, 2018 7:43 am

Almost the same thing here.

I added an SQL VM to a job and wanted to back it up but could not use QuickBackup due to lack of existing full backup file. Sometimes you just want to run a job against a VM immediately for political as well as practical reasons e.g. SQL log backup and truncation.
t481
Enthusiast
 
Posts: 41
Liked: never
Joined: Tue Apr 28, 2015 7:52 am

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Mon Feb 26, 2018 6:55 pm

Then, you can exclude all but one VM, back it up and include other VMs back. Some scripts examples are provided above. Thanks.
v.Eremin
Veeam Software
 
Posts: 14701
Liked: 1100 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: backup single VM (not all VMs) within job?

Veeam Logoby t481 » Tue Feb 27, 2018 8:37 am

I contacted your support team seeking help with the script as I had an issue with it (case no. 02593627) and was told that this is for an older version of Veeam. I was also advised to write a "feature request" here in the forum.
t481
Enthusiast
 
Posts: 41
Liked: never
Joined: Tue Apr 28, 2015 7:52 am

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Tue Feb 27, 2018 6:00 pm

Consider your feature request counted.

As to the script, can you tell me how VMs are added to backup job? As individual VMs or as a part of container (folder, resource pool, etc.)?

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

Re: backup single VM (not all VMs) within job?

Veeam Logoby adb98 » Thu Mar 01, 2018 7:57 pm

I have been wanting to write a script for a while that will do a quick backup via powershell. I have done so but had been contemplating wither to publish it out since I know I will get my fair share of snickers as I am no expert but I decided to go for it. Be easy on me as I not a Powershell god. Once you source the script and have the snappin registered, it will load the snappin, connect to your VBR server you tell it to, lookup the name you are trying to backup, check to see if that name is valid, if not it gives a list that are a close match. If it does match the script moves on and ensures that the backup job the VM is in is not currently running, if that passes it starts the quick backup.

Legal requires me to say run at your own risk. Adjust to suite your needs and enjoy.

Code: Select all
Function QuickBackup {
# ----------------------------------------------------------------------------------------------
# Author - ABelisle - Sr. Sys Admin - THS 03/01/18
#**Legal stuff I have to state** This script comes with no warranty and I am not responsible for any issues this script may cause.
#Prequisites you will need to have the VeeamSnappin registered. It will add the snapping automatically but it has to be there.
#Function of this script is to load VeeamPSSnappin module, log into the main VBR server, check server name not given, and if valid start a quick backup
#Before using source the script . ./veeam quick Backup - after it is sourced. Type QuickBackup to run the script. You must use -vbrserver and type in a Veeam Server
# ----------------------------------------------------------------------------------------------
<#
Examples of this script are as follows:

QuickBackup server1,server2,server3

Example 1 - Quickbackup -vbrserver test -computername server1
Example 2 - Quickbackup -vbrserver test -computername server1,server2


#>
#Parameters   
Param(
[parameter(ValueFromPipeLineByPropertyName=$true,Mandatory=$true)][string[]]$computername,
[parameter(Mandatory=$true)][string[]]$VBRServer)


#Loading Veeam Snappin Piece and Veeam Connection to the server - If it is not registered it tells you and stops the script. Once the Snappin is loaded it trys to connect to the VBR Server

    if( -Not( Get-PSSnapin -Name "VeeamPSSnapIn" -ErrorAction:SilentlyContinue ) ) {
        if( Get-PSSnapin -Registered | Where-Object { $_.Name -eq "VeeamPSSnapIn" } ) {
            # Snap-in is available, but not loaded; Add the snap-in
            Add-PSSnapin -Name "VeeamPSSnapIn"
        } else {
            # Module not available on the computer
            Write-Host -ForegroundColor Red "ERROR: The specified snap-in VeeamPSSnapIn is not found on this computer."
            break
        } # End if
    } else {
        # Module is already loaded

    } # End if


try {((Get-VBRServer -name "$vbrserver" -ErrorAction SilentlyContinue) -eq $null)
    Write-Host -ForegroundColor Green "You are already connected to Veeam VBR server $vbrserver...Skipping sign in"}
catch
    {Write-Host "Please enter your credentials to connect to $vbrserver server"
    $creds = get-credential
    (Connect-VBRServer -server "$VBRServer" -Credential $creds)



#This piece is where we check the server names given and ensure all is ok and run the script. It does this for each VM.

foreach ($c in $computername){
if((Find-VBRViEntity -Name $c) -eq $null){
    Write-Host -ForegroundColor Red "Server $c not valid. These server names listed below are a close match to what you might be looking for. Once name is corrected run it again. "
    (Find-VBRviEntity -Name "*$c*" |select Name)
     break
}
else{
    Write-Host -ForegroundColor Green "Server $c Found. Checking if Job containing VM is running."}
   

if((Find-VBRViEntity -Name $c |Start-VBRQuickBackup -ErrorAction SilentlyContinue) -eq $null){
    write-error "Backup Job with $c in it already running! Check VBR Console"
    break
}
else{
    Write-Host -ForegroundColor Green "Quick Backup Request submitted for $c. Check VBR Console."}
    }
   
} # End Function Load-Module

adb98
Enthusiast
 
Posts: 30
Liked: 3 times
Joined: Thu Jul 21, 2016 5:03 pm
Full Name: Aaron B

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Fri Mar 02, 2018 10:14 am

Thank you, Aaron, for sharing the script; much appreciated.

However, it won't necessarily help in this particular case: Quick Backup requires full backup which does not exist for newly-added VMs.

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

Re: backup single VM (not all VMs) within job?

Veeam Logoby t481 » Mon Mar 05, 2018 11:57 am

The VMs are normally added individually.
t481
Enthusiast
 
Posts: 41
Liked: never
Joined: Tue Apr 28, 2015 7:52 am

Re: backup single VM (not all VMs) within job?

Veeam Logoby v.Eremin » Tue Mar 06, 2018 1:52 pm

I've just checked and the modified script provided on the second page works as expected. Feel free to leverage it. Thanks.
v.Eremin
Veeam Software
 
Posts: 14701
Liked: 1100 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

PreviousNext

Return to PowerShell



Who is online

Users browsing this forum: Bing [Bot] and 7 guests