Showing results for 
Search instead for 
Did you mean: 

Bulk Expiration of Tapes

Level 4
Hello all. While working through some compliance stuff last week I came across a period of time where our organization was obviously keeping everything with an indefinite retention and was tasked by my manager with ensuring anything we have complied with our current retention I wound up with the dubious privledge of having to manually expire approximately 300 tapes across a couple different master servers. Below is the text of a vbscript I wrote that I hope some of you other NBU on Windows admins may be able to make use of. I sort the total media for whatever site I'm working within by its "Time Assigned" field, Ctrl-C that info into an Excel spreadsheet and then just copy the column containing the media ID's into a .txt file I called "OldTapeList.txt". Then I run my script file which reads from the tape list, performs bpexpdate -d 0 -m -force (to supress the y/n prompt) in parallel for every tape listed. You'll have to change the script for your specific location of where you locate your tape list.

This was actually my first ever VBscript, and I hope you all can get some use out of it. I learned a ton writing it. I actually hope to have its powershell conversion done sometime next week (when I get some time).

Please feel free to contact me via (e-mail or IM) with any suggestions or concerns. Use it at your own risk, but it has worked fine for me for over 200 tapes now.

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set SOURCE = objFSO.OpenTextFile("E:\Program Files\VERITAS\NetBackup\bin\admincmd\OldTapeList.txt", ForReading)
EXPIRE = "bpexpdate -d 0 -m"

Do Until SOURCE.AtEndOfStream
WshShell.Run""+EXPIRE+" "+TAPE+" -force"


Level 6
This is a nice script. Couldn't this be done with a simpler batch file? You would first need a text file with the media that you wish to expire. Secondly you write the script to run the bpexpdate command for those items contained within the file. I think that's correct. Anyway, I like your script though... I may just play with it.

Level 4
I actually started out doing it as a batch file, but couldn't find ANY info on how to do a "Do Until" loop. There just seemed to be more information out there supporting the VB Script side. And you're absolutely correct, you do need a seperate file to read the tape ID's out of. I figured that would be less of a hassle than trying to set up some kind of array or something. As you can see in my example above, I've just put the media ID's into a text file called "OldTapeList.txt". I extract the media ID's by copying all the tape info for the tapes I wish to expire into an Excel spreadsheet (control-C will copy all the data out of your media listings) and then copy/cut just the media ID field out of the spreadsheet into my media list. Double-click the script, it'll open up a cmd prompt window for every tape listed, runs the expires in parallel, and are usually all finished in about 8 seconds or so.

The best part is NO INTERACTION once you get the media ID's fed in. The -force option is used with the bpexpdate command for just this reason.

Another thing of note, I copied this file and just changed the command it's running to a "bpmedia -unfreeze -m", and now I have an automatic unfreezing script, I just have to input my tape ID's to the same file I was using before......or make a second list file called "UnfreezeTapeList.txt" or something, change that line in the script, and you're ready to go.