PowerShell script exchange
Post Reply
allan.warner
Influencer
Posts: 14
Liked: 7 times
Joined: Sep 17, 2021 7:03 am
Full Name: Allan Warner
Contact:

Set-ProtectionGroup without creating new credentials....

Post by allan.warner »

Hi,

I have a script where I want to set an existing Protectiongroup..

However the command requires a computer container... However there doesnot appear to be a

Get-VBRIndividualComputerContainer....

So as such you have to create a new computer container.. and this requires a VBRIndividualComputerCustomCredentials... and there is no

Get-VBRIndividualComputerCustomCredentials

So you have to use

New-VBRIndividualComputerCustomCredentials

Which then creates another credential (which you can view in the credential manager)...

Is there anyway to pick up exisitng credentials or computer containers.. So I don't have to keep creating a new credential each time the script runs?


Example from the Veeam docs... https://helpcenter.veeam.com/docs/backu ... ml?ver=110

Code: Select all

$group = Get-VBRProtectionGroup -Name Computers
$comp = $group.Container.CustomCredentials
$supervisor = New-VBRIndividualComputerCustomCredentials -HostName support.east.local -Credentials support\jsmith
$comp += $supervisor
$newcomp = Set-VBRIndividualComputerContainer -Container $group.Container -CustomCredentials $comp
Set-VBRProtectionGroup -ProtectionGroup $group -Container $newcomp
allan.warner
Influencer
Posts: 14
Liked: 7 times
Joined: Sep 17, 2021 7:03 am
Full Name: Allan Warner
Contact:

Re: Set-ProtectionGroup without creating new credentials....

Post by allan.warner »

Ok, so it was me being an idiot..
You don't need to create a new container.. you can grab the existing container from the existing PG group...

Code: Select all

$group.Container # container for the group.
$group.Container.CustomCredentials  # Custom credentials for the group..
Example code:

Code: Select all

$group= Get-VBRProtectionGroup -Name "group_PG" -ErrorAction SilentlyContinue
$DeploymentOpt = New-VBRProtectionGroupDeploymentOptions -InstallAgent

Set-VBRProtectionGroup -ProtectionGroup $group -Container $group.Container -DeploymentOptions $DeploymentOpt
Post Reply

Who is online

Users browsing this forum: No registered users and 29 guests