Tags

, ,


I’ve been running Backup Exec for a few years and it is on the whole pretty reliable, but sometime an issue occurs where a blank/formatted tape in a media set will not get used by a job until I re-assign the media to “Scratch” media and then back to the Media Pool that the job wants to get tapes from. This is a real pain as I have to check every day for jobs sitting on “Queued” status and then deal with it. So I started exploring with the BEMCMD Command Line Tool to see if I could solve the situation, in the course I decided to write some powershell scripts to play with various functions of the backup system.

The first powershell script I wrote was to get the library name and then unlock the library:

c:
cd "\Program Files\Symantec\Backup Exec"
#
# Get Library Name and get rid of blank lines in output
#
$a=.\bemcmd -o84 -j|where {$_ -ne ""}
#
# Seperate Device name
#
$o = $a[0].split(":")
$device=$o[1].Trim()
#
# Unlock the library now we know its name
#
$c=".\bemcmd -o105 -a"+'"'+$device+'"'
#
# execute the unlock
#
cmd /c $c

You can place this into a file called “unlock.ps1” and then create a DOS batch file to run the script from the DOS command line. The batch file just needs “powershell c:\unlock.ps1” in it. If the script comes up with an execution error then use set-executionpolicy unrestricted in a powershell window.

You can create a “Lock” library script, just change the -o105 with -o104

Advertisements