cancel
Showing results for 
Search instead for 
Did you mean: 

Powershell script in order to eject tapes automatically

itDPTech
Level 3

Hello,

I am working on a Powershell script that ejects the tapes used  by BE for backup jobs.
I have looked into the "Backup Exec Management Command Line Interface" yet I can't find any way to link a job to a tape.

I have the possibility to list out the recent jobs and I also can list out the tapes in the different slots but I can't know which job used which tape...

The closest I have got to was using a "Get-BEJobLog", we know the name of the job and the drive  used but, unfortunatly, this returns the string that represents the contents of the job log.

Does anyone have a solution please?

Thank you,

Sam

11 REPLIES 11

lmosla
Level 6

I haven't been able to find any scrips for this execpt the ones found here http://www.symantec.com/docs/TECH218484

pkh
Moderator
Moderator
   VIP    Certified

There is no need for any scripting.

If you are using a stand-alone tape drive, then you just need to enable the Eject After Job Completes option to eject the tape.

If you are using a tape library, you need to enable the mail or I/O slots of the tape library and then add an export stage to the job.  This export stage will then export the tape used in the job to the mail or I/O slots.

itDPTech
Level 3

Hi,

I have a tape library. The script that Imosla found seems to be the same as simply checking the "Eject the media after the job completes" for a job.

This, unfortunatly, doesn't work for me. I have allready tried checking the "Export the media after the job completes" however I don't have any options for the "Export Media to vault"... 
This is the reason why I was trying to do a script. 


I do not know how I could enable the mailslot through Backup Exec? I am able to eject the tapes manually, through the web console of the tape library so the mailslot is functionnal. Do I have to do some kind of inventory or scan ?

Any ideas?

Thank you,
 

Colin_Weaver
Moderator
Moderator
Employee Accredited Certified

 You configure the mailslots in the library itself, not in Backup Exec - in fact the Backup Exec console should not even show the mailslots (although one of the debug logs from Backup Exec will tell how many the library has comfigured) Backup Exec will show the standard slots (where tapes are held and taken form for backup operations)

The term Eject refers to an operation for a stand alone tape drive, if you were going to use that term against a library then really it would mean the action of taking the tape out of the drive (which the robotic arm does) before it is returns the tape to one of the slots - so not the term that applies to how you would remove the tape from a libary.

 

The term export is the term used to move a tape from a slot to a mailslot so that you can remove it from the libary. With the term import being moving a tape from a mailslot to a slot.

 

A media vault is a logical representation that is used to help you understand where the tapes are located once they are removed from the libary, you have to configure logical vaults and vault rules within Backup Exec, however you do not have to use vaults unless you need to for your own tape management and I suspect Export to Vault will not exist if you have not configured vaults and/or vault rules and have mailslots configured in your library.

Note: any tape not in in attached tape drive or library will be shown as offline so you do not have to use vaults.

itDPTech
Level 3

The mailslot should be properly configured as I can export the tapes manually. However I have discovered that my tape library Quantum Superloader 3 doesn't support automatic import/export of media (source : http://www.experts-exchange.com/Software/Backup_Restore/Q_25084456.html ).

With this in mind, does ayone know how I could use a script in order to eject the media of my Library that have just been used for the backup of some jobs?

Thank you

pkh
Moderator
Moderator
   VIP    Certified

Since you are using a tape library, the eject function is not applicable.

You don't have to enable the mailslot in BE.

To export a tape to the mailslot, right-click on the slot in which the tape resides and select Export.

To export a tape automatically after a backup job, you have to add a Export stage to run after the backup job.

Do read the Admin Guide for more details of the Export function.

pkh
Moderator
Moderator
   VIP    Certified

As I said earlier, to export a tape automatically after a backup job, you have to add a Export stage to run after the backup job. No scripting is required.

I do not subscribe to Expert Exchange, so I cannot see the answer that you are referring to.  However, I do not believe that your library is incapable of an automatic export.  An export is an export whether you do it manually or via a job stage.  I take it that when you said that you are able to export the tape manually, you are doing it from the BE console. If not, describe how you do the export.

You can do an export using the BEMCLI cmdlet, Submit-BEExportMediaJob

itDPTech
Level 3

Hello,

Unfortunatly, if I add the "export tape after job" stage it runs successfully but no tape is exported... 
Backup Exec doesn't seem to see the mailslot of my Robotic Library because if I right click a tape and "export media" the job is successful but nothing happens.

When I say that I export the tapes manually, what I do is export the tape needed through the web console of the tape library (nothing to do with backup exec).

I have also made sure that in the "Alert configuration" for Media Removal, it responds by "Yes" after 1 minute.

I don't necessarily want to do a script however I do not see any other solutions. 

Concerning the script, my problem is that I can't find a way to know which job wrote on which tape.

What are my possibilities?

Thank you,

pkh
Moderator
Moderator
   VIP    Certified

What is the total number of slots in your library?  How many mailslots have you enabled?  How many slots do you see in BE?  By right, you should see the total number of slots minus the number of mailslots.

You should remove the auto-response for the Media Removal alert.

You should also try re-installing your tape library

1) In the BE console, delete both the tape library and the tape drive(s)

2) Stop the media server and the library

3) Start the tape library

4) Start the media server

5) Ensure that the library and tape drive is recognised and functioning correctly in the Windows Device Manager. The library should appear as an Unknown Medium Changer with a Microsoft driver and the tape drive should have a Symantec driver.

6) Target your jobs to some other device, save it and then target it to the tape library again.

7) Try your export again.

itDPTech
Level 3

Hello,

I did these steps yesterday and this morning I still have the same result. The export job has completed but not done anything.

However, I noticed that this job had the barcode of the tape used in the job log.

So I looked at the script command "Get-BEExportUtilityJob" and realised that the parameter "Storage" was empty. I believe this could be the problem.

Do you know of a way to change this ? How could I set the storage of this export job as the tape library?


Thank you,

itDPTech
Level 3

Can anyone help me out please ?
Thank you :)