PowerShell script exchange
Post Reply
eeldivad
Influencer
Posts: 11
Liked: never
Joined: Apr 23, 2019 3:43 pm
Full Name: David Lee
Contact:

How to generate list of machines view on web portal

Post by eeldivad »

When logging into the Veeam web portal, there is a tab for "Machines". I want to get the same list and columns that this page generates but I'm having trouble figuring out how using the powershell module Veeam.backup.powershell. I need to automate this data and import it into a custom database for integration purpose. Does anyone know how to get this data using powershell? If not, does anyone know the SQL query to extract this straight from the database?

Thanks!
oleg.feoktistov
Veeam Software
Posts: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: How to generate list of machines view on web portal

Post by oleg.feoktistov »

Hi David,

You can, of course, use our powershell module, but it is a part of a VBR console, not Enterprise Manager. So, if you have more than one VBR server added to your EM portal, you would need to connect from VBR console to each VBR server through powershell and execute the script below, which is just an example of what you could do:

Code: Select all

$backups = Get-VBRBackup
$objectOibs = @()
foreach ($backup in $backups) {
    $jobName = $backup.JobName
    $repoName = $backup.GetRepositoryName()
    $objects = $backup.GetObjectOibsAll()
    foreach ($object in $objects) {
        $objectOib = $object.GetObjectOibs() 
        $name = $objectOib.GetDisplayName()
        $rpCount = $objectOib.Oibs.Count
        if ($object.IsVApp -eq $false) {
        $objectOibs += $objectOib | select @{n='Machine';e={$name}}, @{n='JobName';e={$jobName}}, `
  @{n='RestorePoints';e={$rpCount}}, @{n='Location';e={$repoName}}, @{n='LastSuccess';e={$_.LastOib.CreationTime}}
    }
    else {
        $objectOibs += $objectOib | select @{n='vApp';e={$name}}, @{n='JobName';e={$jobName}}, `
  @{n='RestorePoints';e={$rpCount}}, @{n='Location';e={$repoName}}, @{n='LastSuccess';e={$_.LastOib.CreationTime}}
    }

   }
}
We do have REST API service binded to EM, so if you consider using it for your case, we can try to figure out the way to obtain this data in scope of the other thread in this subforum.

Anyway, since Machines view contains data gathered across multiple tables, the best direct way to get the same info is to just click on "Export" button right beside "Refresh" in the upper-right corner of the view to have it downloaded as an excel file. Either with APIs or SQL queries you would still need to get relevant data from different locations in the DB to construct a representation for the same view.

Thanks,
Oleg
eeldivad
Influencer
Posts: 11
Liked: never
Joined: Apr 23, 2019 3:43 pm
Full Name: David Lee
Contact:

Re: How to generate list of machines view on web portal

Post by eeldivad »

Oh yes if EM has a REST API that would be much easier since I'm having some authentication issues with powershell remotely. I did a quick search on the subforum but don't see anything. I just started a new post here and could use some assistance :)
restful-api-f30/how-to-generate-list-of ... 76416.html
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests