Powershell to get list of VM's in a Veeam backup job

PowerShell script exchange

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby v.Eremin » Wed Apr 20, 2016 12:45 pm

Apologize. I hadn't been fast enough to update the code before you spotted. :)

The missing part was .Options. between $Job and .SanIntegrationOptions.

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

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby jimmymc » Wed Apr 20, 2016 1:09 pm 1 person likes this post

Ha - perfect, thanks and appreciated..

Cheers, James
jimmymc
Service Provider
 
Posts: 29
Liked: 3 times
Joined: Thu Dec 09, 2010 3:06 pm

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby jimmymc » Fri Apr 22, 2016 2:05 pm

Sorry, one more thing! As well as the options for each job (which is working great), I'm trying to get a count of VMs within each job tagged on the end (not 'objects' per-se, as it may well list a folder as an object). Could someone help out with adding this?

Thanks again in advance..

Cheers, James
jimmymc
Service Provider
 
Posts: 29
Liked: 3 times
Joined: Thu Dec 09, 2010 3:06 pm

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby v.Eremin » Mon Apr 25, 2016 9:45 am

So, what is selected as a job source - individual VMs or container, such as folder, resource pool and so on? Based on the source settings, the approach might vary. Thanks.
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby jimmymc » Mon Apr 25, 2016 10:08 am

Hi - All our jobs are based on folders thanks.. there are sub-folders of course..

Thanks for the help on this..

Cheers, James
jimmymc
Service Provider
 
Posts: 29
Liked: 3 times
Joined: Thu Dec 09, 2010 3:06 pm

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby vmniels » Mon Apr 25, 2016 11:20 am 1 person likes this post

The following script counts the VM's within a folder in a job:
Code: Select all
asnp veeampssnapin

$jobs = Get-VBRJob -Name "BACKUPJOBWITHFOLDERS"

$vms = 0
$objects = $jobs.GetObjectsInJob()
$type = $objects.GetObject().Type

foreach ($object in $objects) {
    $type = $object.GetObject().Type
               
    if ($type -eq "VM") {
        $vms++
    } else {
        $jvm = Find-VBRViEntity -VMsAndTemplates -Server (Get-VBRServer) | Where { $_.VmFolderName -eq $object.Name }
    }
}

foreach ($vm in $jvm) {
    $vms++
}

Write-Output $vms
VCP-DCV
Veeam Certified Engineer
http://foonet.be
vmniels
Veeam Software
 
Posts: 1515
Liked: 328 times
Joined: Mon Jul 15, 2013 11:09 am
Full Name: Niels Engelen

[MERGED] Using Powershell to get backup job AD account ?

Veeam Logoby albertwt » Thu Jun 16, 2016 4:59 am

Hi All,

I was looking for a way to get the list of the Backup job and its Service account / credentials that is in use with Veeam Powershell.
Is that possible ?

Because my predecessor was setting all of the backup job (~78 in total) with DOMAIN\Administrator which now has to be changed with the proper service account.
Any help on the Powershell script would be greatly appreciated.

Thanks.
--
/* Veeam software enthusiast user & supporter ! */
albertwt
Expert
 
Posts: 607
Liked: 19 times
Joined: Thu Nov 05, 2009 12:24 pm
Location: Sydney, NSW

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby PTide » Thu Jun 16, 2016 2:36 pm

Hi,

Please check this post

Thanks
PTide
Veeam Software
 
Posts: 3021
Liked: 246 times
Joined: Tue May 19, 2015 1:46 pm

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby ldasilva » Wed Apr 26, 2017 4:22 pm

Hello,

Is there a way i can get a copy of the finished script?

Thank you
ldasilva
Novice
 
Posts: 5
Liked: never
Joined: Tue Apr 25, 2017 5:43 pm
Full Name: Lisandro da Silva

Re: Powershell to get list of VM's in a Veeam backup job

Veeam Logoby v.Eremin » Wed Apr 26, 2017 6:54 pm

Can you provide an answer to the question asked above - what is selected as backup job source? Container or individual VMs?
v.Eremin
Veeam Software
 
Posts: 13281
Liked: 970 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Previous

Return to PowerShell



Who is online

Users browsing this forum: No registered users and 3 guests