script to restore list of files from tape -Files to Tape Job

PowerShell script exchange

script to restore list of files from tape -Files to Tape Job

Veeam Logoby ccatlett1984 » Fri Mar 18, 2016 7:52 pm

I have a files to tape job, I need to recover ~1500 files from tape.

I'd like to be able to feed this list into a restore job via powershell (I will cry if I need to use the gui.)
ccatlett1984
Enthusiast
 
Posts: 83
Liked: 9 times
Joined: Thu Oct 31, 2013 5:11 pm
Full Name: Chris Catlett

Re: script to restore list of files from tape -Files to Tape

Veeam Logoby ccatlett1984 » Fri Mar 18, 2016 8:24 pm

I tried the following:
Code: Select all
$files = gc "C:\sql_files_to_restore.txt"
Start-VBRTapeRestoreFiles -Files $files -Server milivvbackup01 -Path s:\ -PreserveHierarchy -Security -RunAsync
ccatlett1984
Enthusiast
 
Posts: 83
Liked: 9 times
Joined: Thu Oct 31, 2013 5:11 pm
Full Name: Chris Catlett

Re: script to restore list of files from tape -Files to Tape

Veeam Logoby v.Eremin » Mon Mar 21, 2016 12:37 pm

As mentioned in User Guide, -Files should be of CatalogueFile type. And Tape Catalogue can queried via obsolete Find-VBRTapeCatalog commandlet. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: script to restore list of files from tape -Files to Tape

Veeam Logoby ccatlett1984 » Mon Mar 28, 2016 1:41 pm

So, I guess I'm looking for some help on how to write this script.

I have a list of the files that need to be restored, do I need to run each file through a for-each loop through the find-vbrtapecatalog cmdlet and build an array or custom object?

I need to be able to feed in the script, and be told what tapes are needed and have a single restore job created.

Due to the number of files, this isn't something I can do through the gui.
ccatlett1984
Enthusiast
 
Posts: 83
Liked: 9 times
Joined: Thu Oct 31, 2013 5:11 pm
Full Name: Chris Catlett

Re: script to restore list of files from tape -Files to Tape

Veeam Logoby v.Eremin » Mon Mar 28, 2016 3:52 pm

Do I need to run each file through a for-each loop through the find-vbrtapecatalog cmdlet and build an array?

Correct. For each file you will need to take its name from .txt, locate the file in catalog, using Find-VBRTapeCatalog cmdlet, add it to an array of CatalogueFile type. After that, execute restore.

Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 7 guests