PowerShell script exchange
Post Reply
McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

V8 changes

Post by McClane » Nov 11, 2014 7:44 am

Hi,

I am testing out the new version and saw some changes to the powershell commandlets.
The get-vbrtapemedium returns the location of the tape in the library, but it only says "Slot" without any number now. In the gui the correct number is displayed.
Documenatation says it should return the slot ID, as in V7.

Greetings,

Manuel

veremin
Product Manager
Posts: 16666
Liked: 1390 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: V8 changes

Post by veremin » Nov 11, 2014 9:04 am

Hi, Manuel,

Please, try the following script and see whether it meets your expectations:

Code: Select all

Get-VBRTapeMedium | where {$_.location -like "Slot"} | select name, {$_.Location.SlotAddress}
Thanks.

McClane
Expert
Posts: 106
Liked: 11 times
Joined: Jun 20, 2009 12:47 pm
Contact:

Re: V8 changes

Post by McClane » Nov 11, 2014 9:27 am 1 person likes this post

Works like a charm. Thanks.

veremin
Product Manager
Posts: 16666
Liked: 1390 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: V8 changes

Post by veremin » Nov 11, 2014 9:32 am

You're welcome. Should other questions arise, don't hesitate to reach us.

willn
Influencer
Posts: 15
Liked: never
Joined: May 07, 2012 1:47 pm
Full Name: William Nelson
Contact:

Re: V8 changes

Post by willn » Nov 11, 2014 4:39 pm

So, I was using the method isoverwriteprotectionperiodover() in one of my scripts for the same get-vbrtapemedium cmdlet and now that has been taken out with v8.

Is there an alternative to this method in v8?

veremin
Product Manager
Posts: 16666
Liked: 1390 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: V8 changes

Post by veremin » Nov 12, 2014 9:35 am

Can you query .expirationdate parameter, instead? Something like:

Code: Select all

$Medium.ExpirationDate -eq (Get-Date)
Thanks.

veremin
Product Manager
Posts: 16666
Liked: 1390 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: V8 changes

Post by veremin » Nov 12, 2014 10:51 am

I believe you can also use IsExpired parameter. Just make sure to discard free mediums. The following script, for instance, lists all non-free, unexpired tapes:

Code: Select all

Get-VBRTapeMedium | ?{($_.isfree -eq $false) -and ($_.IsExpired -eq $false)
Thanks.

willn
Influencer
Posts: 15
Liked: never
Joined: May 07, 2012 1:47 pm
Full Name: William Nelson
Contact:

Re: V8 changes

Post by willn » Nov 12, 2014 7:24 pm

Thanks Eremin, I believe this will work for these purposes, but there are other methods you guys have removed regarding tapes and cmdlets. Is there a reason for taking these out?

veremin
Product Manager
Posts: 16666
Liked: 1390 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: V8 changes

Post by veremin » Nov 13, 2014 7:47 am

You're right, the PowerShell tape mode has been restructured. We've done it mostly due to previous model missing options and having multiple design shortcomings. Like, it was not possible to change most of backup to tape job, file to tape job, media pool settings, etc.

It required major design reconsideration, indeed, but we tried to preserve compatibility and provide alternatives for replaced methods and parameters.

Thanks.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 4 guests