Page 4 of 4

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

Veeam LogoPosted: Wed Apr 20, 2016 12:45 pm
by v.Eremin
Apologize. I hadn't been fast enough to update the code before you spotted. :)

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

Thanks.

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

Veeam LogoPosted: Wed Apr 20, 2016 1:09 pm
by jimmymc
Ha - perfect, thanks and appreciated..

Cheers, James

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

Veeam LogoPosted: Fri Apr 22, 2016 2:05 pm
by jimmymc
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

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

Veeam LogoPosted: Mon Apr 25, 2016 9:45 am
by v.Eremin
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.

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

Veeam LogoPosted: Mon Apr 25, 2016 10:08 am
by jimmymc
Hi - All our jobs are based on folders thanks.. there are sub-folders of course..

Thanks for the help on this..

Cheers, James

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

Veeam LogoPosted: Mon Apr 25, 2016 11:20 am
by vmniels
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

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

Veeam LogoPosted: Thu Jun 16, 2016 4:59 am
by albertwt
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.

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

Veeam LogoPosted: Thu Jun 16, 2016 2:36 pm
by PTide
Hi,

Please check this post

Thanks

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

Veeam LogoPosted: Wed Apr 26, 2017 4:22 pm
by ldasilva
Hello,

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

Thank you

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

Veeam LogoPosted: Wed Apr 26, 2017 6:54 pm
by v.Eremin
Can you provide an answer to the question asked above - what is selected as backup job source? Container or individual VMs?