PowerShell script exchange
Post Reply
YannickMetz
Enthusiast
Posts: 32
Liked: 3 times
Joined: Nov 06, 2017 12:55 pm
Full Name: Yannick Metz
Contact:

Inventory and erase tape automaticly

Post by YannickMetz »

Hello,

i am using a script that does an inventory and an erase before every tape job starts.
I had some issues with it and the support said custom scripts are not supported.

Can anyone give me a supported script for my case?

The powershell script looks like this:

Add-PSSnapin VeeamPSSnapin
$tape = Get-VBRTapeMedium –library “Tape LTO-6 Week” | where {$_.location.type –eq “drive”}

Start-VBRTapeInventory –library „tape –LTO-6 Week” –wait
Erase-VBRTapeMedium –Medium $tape

Thanks and best regards
Y
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Inventory and erase tape automaticly

Post by veremin »

What exact issues do you have? Firstly I'd start with changing the line order (line 3 and 2), so tape discovery happens after library inventory. Thanks.
YannickMetz
Enthusiast
Posts: 32
Liked: 3 times
Joined: Nov 06, 2017 12:55 pm
Full Name: Yannick Metz
Contact:

Re: Inventory and erase tape automaticly

Post by YannickMetz »

Some times the script only inventories the the tape but does not erase it,
some times it does nothing
or it inventories it but removes it from catalog so that i have to move it in the mediapool again.

support could not help very much.

so the discovery starts in the erase task? It will try to erase the old tape and not the new tape i just put in the drive

Thank you
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Inventory and erase tape automaticly

Post by veremin » 1 person likes this post

so the discovery starts in the erase task?
Nope, you should assign tape to variable after inventory, not after. I think this is the root cause of the issues experienced.

Inventory updates information regarding tape device and tapes present in it. So, that's why this step should be first:

Code: Select all

Add-PSSnapin VeeamPSSnapin
Start-VBRTapeInventory –library „tape –LTO-6 Week” –wait
$tape = Get-VBRTapeMedium –library “Tape LTO-6 Week” | where {$_.location.type –eq “drive”}
Erase-VBRTapeMedium –Medium $tape
Thanks.
YannickMetz
Enthusiast
Posts: 32
Liked: 3 times
Joined: Nov 06, 2017 12:55 pm
Full Name: Yannick Metz
Contact:

Re: Inventory and erase tape automaticly

Post by YannickMetz »

Thank you. Works fine!
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Inventory and erase tape automaticly

Post by veremin »

You're welcome. Good to know that changing the line order has done the trick for you. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests