PowerShell script exchange
Post Reply
drota
Lurker
Posts: 2
Liked: never
Joined: Mar 28, 2023 3:56 pm
Full Name: Dario Rota
Contact:

-Multitag use on AddVBRViBackupJob

Post by drota »

Hello there.

i am using veeam console version 11.0.1.1261 P20220302
Wrapping my mind around "Multitag" switch is giving me a hard time.
I am tryng to create a backup job with tag combination as the only criteria, say <Tenant_TAG> & <RPO_TAG>.
First order of problem: the "Entity" block of Add-VBRViBackupJob what it should be?
Cannot be empty, cannot be one of the tags(*), cannot be both tags (or if it can?).
Should it be the vCenter?
Then to the Multitag switch (assuming vCenter server as Entity)

Code: Select all

$tenant=Find-VBRViEntity -Server <vCenter server name> -Tags -Name "<Tenant-TAG>" 
$rpo=Find-VBRViEntity -Server <vCenter server name> -Tags -Name "<RPO_TAG>"
$repo=Get-VBRBackupRepository -Name "<Repository Name>"
# First try, check * note
# Add-VBRViBackupJob -Entity %tenant -Name "Test MultiTagJob" -Description "Job to test Multitag option for vCenter job w/Powercli Add-VBRViBackupjob" --BackupRepository $repo -Multitag $tenant $rpo
Get-VBRServer -Name "<vCenter server name>" | Add-VBRViBackupJob -Name "Test MultiTagJob" -Description "Job to test Multitag option for vCenter job w/Powercli Add-VBRViBackupjob" -BackupRepository $repo -Multitag $tenant $rpo
Always prompts an error regarding the parameters.
Add-VBRViBackupJob : A positional parameter cannot be found that accepts argument

Documentation says "Defines that the cmdlet will add tags to an existing job." (https://helpcenter.veeam.com/archive/ba ... upjob.html)
So instead of using Multitag in Add-VBRViBackupJob, the criteria should be provived via Add-VBRViJobObject(**)?
What am I misssing?
Should the tags be passed as a single object, e.g.:
$tags=Find-VBRViEntity -Server <vCenter server name> -Tags | ? { $_.Name -eq "<Tenant_TAG>" -or $_.Name -eq "<RPO_TAG>" } s
(straight from powershell-f26/how-to-add-tag-combionat ... 76076.html)

Any help would be appreciated.
Thanks.

Dario.

* somewhat false, it can be, but then the Multitag will add its criteria to the first tag, not what intended.
** Already tried, guess what: Add-VBRViJobObject: A positional parameter cannot be found that accepts argument
ronnmartin61
Veeam Software
Posts: 514
Liked: 167 times
Joined: Mar 07, 2016 3:55 pm
Full Name: Ronn Martin
Contact:

Re: -Multitag use on AddVBRViBackupJob

Post by ronnmartin61 »

"Entity" should be the tag list retrieved from your virtual infrastructure. It may not answer all your questions but the following worked in my lab -

Code: Select all

$tagNames =  "Ubuntu Tag" , "XA Controller"

$tags = Find-VBRViEntity -Name $tagNames -Tags

$repo = Get-VBRBackupRepository -Name "MyRepo"

Add-VBRViBackupJob -Entity $tags -Multitag  -BackupRepository $repo  -name "Multitag Job"
drota
Lurker
Posts: 2
Liked: never
Joined: Mar 28, 2023 3:56 pm
Full Name: Dario Rota
Contact:

Re: -Multitag use on AddVBRViBackupJob

Post by drota »

Thank you ronnmartin61.
As you stated, it works as intended.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest