Comprehensive data protection for all workloads
Post Reply
jwallen21
Lurker
Posts: 1
Liked: never
Joined: May 20, 2013 7:54 pm
Full Name: Jason Allen
Contact:

Backup VM's by VMware attributes/tables

Post by jwallen21 »

Hello Everyone,

I am fairly new on here. Currently i have 2 proxy servers and plan on adding at least one more proxy. I have been playing around with veeam for a couple of weeks now currently on 6.5.128. I have been working with netbackup for about 3 years and just convinced management that Veeam is alot better product for vitalization. So there is one item that i really liked about that product in netbackup they have a section that allows you to query VMware and only backup up with certain attributes which saves alot of time for my team. We have a 300 plus VM infrastructure and don't need to manually add new server every time we build a new server. Right now i am grouping the vms using pools but the way i see veeam works is every job only backs up one server at a time. I need to lessen the groups by Has anyone messed with the power shell enough to be able to query VMware and backup vm's by several different attributives.For example i would like to backup VM's by pool but omit servers with independent drives in the backup.
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup VM's by VMware attributes/tables

Post by veremin »

Previously I’ve written two separate script, one of which is responsible for VM independent disk checking, the other for excluding VM objects.

So, it might be worth taking a look at them as a first point of your search. Otherwise, a little bit later I can try to combine them in one script that is likely to meet your expectations.

Hope this helps.
Thanks.
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Backup VM's by VMware attributes/tables

Post by veremin »

So, here is a combined version of the two scripts mentioned above:

Code: Select all

Asnp VMware.VimAutomation.Core
Asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your backup job"
$VMs = $Job | Get-VBRJobObject 
Connect-VIServer -Server "Name of vCenter" -User "User name" -password "User password"
Foreach ($VM in $VMs)
{
        $VM = Get-VM | ?{$_.name -eq $VM.name}
        foreach ($Harddisk in $VM.Harddisks)
        {  
            If ($Harddisk.Persistence -eq "IndependentPersistent") {
            Write-OutPut "$VM has independent disks which will be excluded from the backup Job"
            $object = Get-VBRJobObject –job ($job)| ?{$_.Name –eq “$VM”}
            Remove-VBRJobObject –job ($job) –object ($object)
            Break}
        }
}  
The algorithm looks like this:

1) First of all, the script takes a corresponding job and gets list of job objects.
2) Then, it connects to vCenter and checks whether job objects (VMs) have independent disks or not.
3) If so, such VMs are excluded from backup job.

Hope this helps.
Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 139 guests