PowerShell script exchange
Post Reply
kuchi
Novice
Posts: 5
Liked: never
Joined: Sep 26, 2012 6:00 am
Full Name: Alexander Kuchelbacher
Contact:

Get unprotected VMs hyperv

Post by kuchi »

Hi!
We have SCVMM and one HyperV-Cluster which is in our Veeam Environment.
Is there any possibility to verify which VMs from both hyperv Environments are not in any backupjob?
Vitaliy S.
VP, Product Management
Posts: 27055
Liked: 2710 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Get unprotected VMs hyperv

Post by Vitaliy S. »

Hi Alex,

I'm pretty sure our PowerShell experts will help you with this task, but if you have Veeam ONE (part of Veeam Backup Management Suite), you can generate this report in 1-click. Please see this link for more information on predefined "Protected VMs" report template > http://helpcenter.veeam.com/one/70/repo ... d_vms.html

Thanks!
kuchi
Novice
Posts: 5
Liked: never
Joined: Sep 26, 2012 6:00 am
Full Name: Alexander Kuchelbacher
Contact:

Re: Get unprotected VMs hyperv

Post by kuchi »

thanks, since veeam one is not licensed here I Need to do over powershell. many thanks
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get unprotected VMs hyperv

Post by veremin »

Can you tell me how VMs are added to a backup job? As individual objects or through container? Thanks.
kuchi
Novice
Posts: 5
Liked: never
Joined: Sep 26, 2012 6:00 am
Full Name: Alexander Kuchelbacher
Contact:

Re: Get unprotected VMs hyperv

Post by kuchi »

we have scvmm 2012r2 included and one hyperv 2008 r2 Cluster.
we have several Jobs which have included different virtual machines.
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get unprotected VMs hyperv

Post by veremin »

In the settings of backup jobs what is selected as a source - individual VMs or cluster (host) as whole? Thanks.
kuchi
Novice
Posts: 5
Liked: never
Joined: Sep 26, 2012 6:00 am
Full Name: Alexander Kuchelbacher
Contact:

Re: Get unprotected VMs hyperv

Post by kuchi »

Individual VMs
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get unprotected VMs hyperv

Post by veremin »

Then, you should get a list of VMs included in backup jobs, using Get-VBRJobObject commandlet. Then, get a list of all VMs residing on a cluster/host, using Get-VM commandlet. After that, compare two lists and output the difference - names of VMs that are present in the second list, but are not in the first one. These will be your unprotected VMs.

Thanks.
kuchi
Novice
Posts: 5
Liked: never
Joined: Sep 26, 2012 6:00 am
Full Name: Alexander Kuchelbacher
Contact:

Re: Get unprotected VMs hyperv

Post by kuchi »

I know that, but I am struggling with to get the names of the vm from vbrjobs
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get unprotected VMs hyperv

Post by veremin »

The names of Virtual Machines present in backup jobs can be collected in the following way:

Code: Select all

Get-VBRJob | where {$_.Jobtype -eq "Backup"} |  Get-VBRJobObject | select {$_.name}
Thanks.
pizzim13
Enthusiast
Posts: 94
Liked: 6 times
Joined: Apr 21, 2011 7:37 pm
Contact:

Re: Get unprotected VMs hyperv

Post by pizzim13 »

One quick suggestion, I would do this using the vm's GUID/MoRef and not by name. Names can be duplicated and it will cause you nothing but headaches.
veremin
Product Manager
Posts: 20271
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get unprotected VMs hyperv

Post by veremin »

Names would still be required though, as hardly would you be able to make a sense over IDs. Report containing only long digit numbers wouldn't be very helpful. Thanks.
Ctek
Service Provider
Posts: 83
Liked: 13 times
Joined: Nov 11, 2015 3:50 pm
Location: Canada
Contact:

Re: Get unprotected VMs hyperv

Post by Ctek »

Hi,

I am bumping this thread since I am looking to script somewhat the same thing because VeeamOne Reports does not give us the amount of information we need. So far I have a hard time matching a unique VM ID in Hyper-V with a VM ID in veeam backup job. I can't seem to find something to compare backed up VMs precisely with an ID. We are in an environment where duplicate names are involved.

Do you have any tips to share on this matter? Thanks in advance.
VMCE
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Get unprotected VMs hyperv

Post by Shestakov »

Hi,
I`m curious which Veeam ONE reports you use?
So far I have a hard time matching a unique VM ID in Hyper-V with a VM ID in veeam backup job. I can't seem to find something to compare backed up VMs precisely with an ID. We are in an environment where duplicate names are involved.
I would just use Protected VMs report or new Backup Infrastructure Custom Data with object type = VM, Columns = Name, Computer Name, IP Address, Last backup Date, Last Backup Status.
Thanks!
Ctek
Service Provider
Posts: 83
Liked: 13 times
Joined: Nov 11, 2015 3:50 pm
Location: Canada
Contact:

Re: Get unprotected VMs hyperv

Post by Ctek »

Hi Nikita,

Our problem with VeeamOne Protected VMs report is that it's highly inconsistent and unreliable. I get a lot of unprotected VM's (sometimes ALL vms shows unprotected) in the generated report but in reality, they are backed up properly once I verify them one by one. In my homelab with vsphere, I don't have this issue, but at work, a service provider, we have a big Hyper-V environment with SCVMM and backup reports are always hit and miss, with a lot more misses. We create our own scripts to cover these kind of shortcomings.

Should I open a case?
VMCE
Shestakov
Veteran
Posts: 7328
Liked: 781 times
Joined: May 21, 2014 11:03 am
Full Name: Nikita Shestakov
Location: Prague
Contact:

Re: Get unprotected VMs hyperv

Post by Shestakov »

Yes, for sure. Once you open the case, let me know its number.
Does the report show that VMs are never backed up or wrong backup dates?
By the way, what product version are you at?
Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests