PowerShell script exchange
Post Reply
tamiand
Novice
Posts: 4
Liked: 1 time
Joined: Mar 11, 2020 4:30 pm
Full Name: Thierry Amiand
Contact:

Script to restore all VM from a tape mediapool

Post by tamiand »

Hello,
I am looking for a script to restore all VMs whose name is something like toto* from a particular tape mediapool.
Has anyone already done something similar?
david.domask
Veeam Software
Posts: 2163
Liked: 519 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Script to restore all VM from a tape mediapool

Post by david.domask »

Hi Thierry,

You can utilize Find-VBRTapeCatalogItem and Start-VBRTapeFileRestore for this task, even if the Tape jobs are normal Backup to Tape jobs and not File to Tape.

Find-VBRViTapeCatalogItem will need two passes -- pass the source server (usually repository server) found with Get-VBRServer cmdlet, pass that CHost object to the -Server parameter on Find-VBRViTapeCatalogItem and save it to a variable.

Re-run Find-VBRViTapeCatalogItem with -CatalogItem and pass the previously saved variable, and this time include the -Name parameter. You can use normal wildcards like you would for Powershell and build some string to find the desired VM. (e.g., -Name "*my vm*.vbk")

You can then pass those catalog items to Start-VBRTapeFileRestore with the necessary parameters (target server, target path, etc).
David Domask | Product Management: Principal Analyst
tamiand
Novice
Posts: 4
Liked: 1 time
Joined: Mar 11, 2020 4:30 pm
Full Name: Thierry Amiand
Contact:

Re: Script to restore all VM from a tape mediapool

Post by tamiand »

Hi David,
Thanks for to reply.
Ok, it's good beginning. I can find my backup with multiple loop with Find-VBRTapeCatalogItem.
$items = Find-VBRTapeCatalogItem -Name "/"
$items = foreach ($item in $items) { Find-VBRTapeCatalogItem -CatalogItem $item}
$items = foreach ($item in $items) { Find-VBRTapeCatalogItem -CatalogItem $item}
$items = foreach ($item in $items) { Find-VBRTapeCatalogItem -CatalogItem $item}
$items = foreach ($item in $items) { Find-VBRTapeCatalogItem -CatalogItem $item |where-object -Property Name -Like "myvms*vbk" }

But It's don't seems possible to filter them with specific mediapool?
david.domask
Veeam Software
Posts: 2163
Liked: 519 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Script to restore all VM from a tape mediapool

Post by david.domask »

Hi Thierry,

You're very welcome -- regrettably, we cannot tie it specifically to media pools at this time. Is it correct to understand that you have the same backups being copied to tape in multiple tape jobs targeting different media pools?

Regrettably with current Tape Powershell cmdlets, there is room for improvement on some restore processes, so selecting from specific media pool with the built in cmdlets gets tricky -- the cmdlets above read from the Tape Catalog and just tells Veeam Backup and Replication which item to restore, and the application will handle the rest as to which tapes these files are on.

Can you describe your workflow a bit more regarding needing the tapes from specific media pools? I can imagine the reasons, but just want to make sure I am understanding your intended workflow correctly.
David Domask | Product Management: Principal Analyst
tamiand
Novice
Posts: 4
Liked: 1 time
Joined: Mar 11, 2020 4:30 pm
Full Name: Thierry Amiand
Contact:

Re: Script to restore all VM from a tape mediapool

Post by tamiand » 1 person likes this post

Thanks for the reply.
I need to set aside some backups. That's why I want to restore some backups to save them again.
I think I'll manage with the dates in the file names.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests