PowerShell script exchange
Post Reply
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

We have approximately 100 media pools for tapes in our environment. We are wanting to change how we use tape vaults to better reflect physical storage locations for our tapes.

In order to do this, we first have to disable Veeam's automatic logic to assign tapes to vaults. (We will have to write our own logic to perform this operation, since Veeam doesn't support how we exactly do things.)

Anyway, when I went to try to do this, I ran into some unexpected difficulties with the Set-VBRTapeMediaPool option.

First, it appears that the -Library option is improperly set as "mandatory". This doesn't make sense, since we don't want to change the Library the pools are assigned to, we want to leave those settings untouched.

Second, it appears that the -MoveOfflineToVault option is done as a switch, which makes it difficult to say "no", normally just omitting a switch is how you "disable" it, but then will the cmdlet know to actually turn it off? I hope my question makes sense, this parameter IMO should be a boolean parameter, not a switch.

Anyway, this is what I've tried:

Code: Select all

PS C:\Users\redacted> $p = Get-VBRTapeMediaPool
PS C:\Users\redacted> $p | where MoveOfflineToVault | Set-VBRTapeMediaPool -MoveOfflineToVault:$false
Set-VBRTapeMediaPool : The input object cannot be bound because it did not contain the information required to bind all mandatory parameters: Library
At line:1 char:33
+ ... MoveOfflineToVault | Set-VBRTapeMediaPool -MoveOfflineToVault:$false
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (<redacted>:PSObject) [Set-VBRTapeMediaPool], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectMissingMandatory,Veeam.Backup.PowerShell.Cmdlets.SetVBRTapeMediaPool
(The same error message repeats over and over again, for each media pool, but has been omitted for brevity)

So, since it seems the Powershell cmdlets for doing this seem to be a bit lacking in their design, what might I try to use instead?

I also have a support case open for this, but the support wasn't able to get me an immediate answer on this without going to Engineering, so I suspect taking it here on the forums as well would be useful.

#Edited by Mod: Removed Contract ID
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by Mildur »

Hi Per

Can you please check the provided case number?
Case numbers always starting with #05.

Thanks
Fabian
Product Management Analyst @ Veeam Software
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

The correct care ID is 05556938
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by Mildur »

Hi Per

Thanks for the case number. Indeed, that's not optimal. In my opinion, that should be fixed in a future version of Veeam.
I see in the internal case notes, that your support engineer is trying to find a solution (DB query). As far as I see, RestAPI doesn't have tape commands today.
That's the best way forward for now.

Thanks
Fabian
Product Management Analyst @ Veeam Software
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by david.domask »

Hi @pvz,

Indeed it seems a little strange. In testing, there's no harm as I see it in passing the LibraryID array from a given media pool to this parameter, so consider it a work around while it gets resolved.
David Domask | Product Management: Principal Analyst
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

@david.domask, did your testing include media pools with multiple libraries attached to them?
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by Mildur »

It only sets the first library. The second library gets removed. That's what I see in my lab.
I would wait for the SQL Query.

It seems that's another issue.
LibraryID in PowerShell only listing 1 library ID and not all of them.
Product Management Analyst @ Veeam Software
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by david.domask »

Hrm, indeed, not sure why I remembered different when I wrote that.

You can use the following workaround with unsupported .NET methods (I'd actually personally avoid SQL when possible):

$MediaPools = [Veeam.Tape.Core.CTapeMediapool]::GetAll()

This returns all the Media Pools and each Object has a GetLibraries() method that returns the associated libraries.
David Domask | Product Management: Principal Analyst
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

I'm looking at Get-Member for an instance of Veeam.Tape.Core.CTapeMediaPool and I can't find any way to get or set information about the connection between a pool and a vault there?
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

Hi! I also tested with a test pool, and it seems that it's not possible to actually unset the MoveOfflineToVault flag once it's set through the powershell cmdlets.

So it seem then that the only options are the undocumented API functions or through SQL
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

After a bit of digging I managed to figure out how to do this using the undocumented functions in the Veeam DLLs:

Code: Select all

$MediaPoolService = [veeam.backup.core.jobs.tape.engine]::Instance.Session.GetMediaPoolService()
Get-VBRTapeMediaPool | Foreach-Object { $MediaPoolService.UpdateVaultRelations($_.Id, @()) }
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by david.domask »

pvz wrote: Aug 04, 2022 8:58 am I'm looking at Get-Member for an instance of Veeam.Tape.Core.CTapeMediaPool and I can't find any way to get or set information about the connection between a pool and a vault there?
Hi! This class was just to get the libraries. For me in lab the normal cmdlet then worked when passing the libraries array from a mediapool to the cmdlet.

You did not see this?
David Domask | Product Management: Principal Analyst
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

Were you, in the lab, able to get Set-VBRTapeMediaPool to disable MoveOfflineToVault, and if so, how?

The way with the internal undocumented APIs were the only solution I found.
david.domask
Veeam Software
Posts: 2123
Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by david.domask »

HI @pvz, with the native cmdlet and my workaround it worked in lab, but I do think the actual native cmdlet should work without any workarounds needs to be checked.

If possible, can you please open a case and demonstrate:

1. The -Library parameter needs to be set even for options that don't require changes to the added Libraries on a Media Pool
2. The LibraryID property of the media pool only returns the first Library added, not all
3. That without unsupported workarounds, the -MoveOfflineToVault functionality doesn't seem to work?

Please post the case ID once you make it so we can track it.
David Domask | Product Management: Principal Analyst
pvz
Influencer
Posts: 18
Liked: 3 times
Joined: May 28, 2011 10:12 am
Full Name: Per von Zweigbergk
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by pvz »

Thank you for your help, but I don't need anything further right now, so I see no reason to raise another SR.

With your help I was able to figure out a workaround, and there's already a case number mentioned earlier in the post regarding the fact that the -LibraryId parameter is incolrrectrly set as "mandatory". The rest of the information you need to act on this is already here in the forum thread.
Mildur
Product Manager
Posts: 9848
Liked: 2607 times
Joined: May 13, 2017 4:51 pm
Full Name: Fabian K.
Location: Switzerland
Contact:

Re: How can you use Set-VBRTapeMediaPool to disable MoveOfflineToVault on multiple pools?

Post by Mildur »

An update from our site.
We from product management are looking into that case and discuss it internally.

Thanks
Fabian
Product Management Analyst @ Veeam Software
Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests