PowerShell script exchange
Post Reply
ccatlett1984
Enthusiast
Posts: 83
Liked: 9 times
Joined: Oct 31, 2013 5:11 pm
Full Name: Chris Catlett
Contact:

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

Post by ccatlett1984 »

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: Oct 31, 2013 5:11 pm
Full Name: Chris Catlett
Contact:

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

Post by ccatlett1984 »

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
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

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

Post by veremin »

As mentioned in User Guide, -Files should be of CatalogueFile type. And Tape Catalogue can queried via obsolete Find-VBRTapeCatalog commandlet. Thanks.
ccatlett1984
Enthusiast
Posts: 83
Liked: 9 times
Joined: Oct 31, 2013 5:11 pm
Full Name: Chris Catlett
Contact:

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

Post by ccatlett1984 »

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.
veremin
Product Manager
Posts: 20283
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

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

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests