PowerShell script exchange
Post Reply
ipro-bgardner
Influencer
Posts: 10
Liked: 3 times
Joined: May 07, 2021 4:43 pm
Full Name: Brent Gardner
Contact:

How to get credential associated wit a specific machine in an agent backup job?

Post by ipro-bgardner »

Running Backup and Replication v10.0.1.4854.

We have several agent backup jobs managed by the server.

How can I determine the user account associated with the computer in the backup job?

For example, when I create a new Windows agent backup job in the GUI, when I go to add a computer to the list of protected computers, I must supply a hostname or IP address and a credential from the list of credentials already in the system (or I can add a new credential to the list but I must select from the list). This is the credential I'm looking for. Not the password, of course. Just the username.

So far, I've been trying to find a way to correlate between Get-VBRComputerBackupJob, Get-VBRJobObject, Get-VBRCredentials with no success so far.

Regards,

Brent Gardner
oleg.feoktistov
Veeam Software
Posts: 1918
Liked: 636 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: How to get credential associated wit a specific machine in an agent backup job?

Post by oleg.feoktistov »

Hi Brent,

Credential association records are kept inside a protection group container. So, what you need to do is find the protection group,
get job objects and correlate job object names with protection group member names inside credential associations.
Example with "Manually Added" protection group:

Code: Select all

$agentJob = Get-VBRComputerBackupJob
$pg = Get-VBRProtectionGroup -Type ManuallyAdded
foreach ($object in $agentJob.BackupObject) {
  foreach ($computer in $pg.Container.CustomCredentials) {
    if ($computer.HostName -eq $object.Name) {
      $creds = Get-VBRCredentials | where {$_.Id -eq $computer.Credentials.Id}
      $creds
    }
  }
} 
Hope it helps,
Oleg
ipro-bgardner
Influencer
Posts: 10
Liked: 3 times
Joined: May 07, 2021 4:43 pm
Full Name: Brent Gardner
Contact:

Re: How to get credential associated wit a specific machine in an agent backup job?

Post by ipro-bgardner »

Oleg-

This technique worked perfectly.

Thanks!

Brent
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests