cancel
Showing results for 
Search instead for 
Did you mean: 
Karthikeyan_Sun
Level 6
Below mentioned Script takes the media list "D:\Tape_Mgmt_Script\tmpmedialist.txt" as input file and eject those medias as batches to mail slots.
 
Change the robot number as needed on variable "rbnumber"; This script requires all mail slots of library to be free to continue the ejection.
 
and there are 2 empty lines need to be placed end of the input file "D:\Tape_Mgmt_Script\tmpmedialist.txt" to let script identify the end of file.
 
==========================================
On Error Resume Next
Const ForReading = 1
mydate = date()
mc = 0
rbnumber = 0
 
Dim MediaIDInput
 
Set objSysInfo = CreateObject( "WinNTSystemInfo" )
strComputerName = objSysInfo.ComputerName
 
'*********************************************************************************************************************************
'This script is used to do eject the Full Medias to mail slots
' Author - Karthikeyan Sundaram
' Email - Karthikeyan.annur@gmail.com
'*********************************************************************************************************************************
 
Set objShell = CreateObject("Wscript.Shell")
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
 
TmpMListFile = "D:\Tape_Mgmt_Script\tmpmedialist.txt"
 
WScript.echo "Working on identifying the mail slots status"
 
MailSlotStat = "cmd.exe /c vmchange -res -robot_info -verbose -rn " & rbnumber & " -rt tld -rh " & strComputerName & " | findstr Mailslots"
 
Set objExec_MS = objShell.Exec(MailSlotStat)
 
MSStatus = objExec_MS.StdOut.ReadAll
 
MailCountActual = Mid(MSStatus,24,2)
MailCountFree = Mid(MSStatus,28,2)
 
WScript.echo "Total Mail Slots available in tape library is " & MailCountActual
WScript.echo "Free Mail Slots available in tape library is " & MailCountFree
 
Svalue = StrComp(MailCountActual,MailCountFree)
 
If Svalue = 0 then
WScript.echo "All mail slots are available, Good to continue media ejection"
else
WScript.echo "Not All mail slots are empty, Cleanup them"
intButton = objShell.Popup("Not All mail slots are empty, Cleanup the Mail Slots; Once done, Click on OK to continue Media Ejection",,"Attention Needed",48)
End if
 
strMedLine = ""
 
MailSC = MailCountActual-1
 
intButton0 = objShell.Popup("Verify the Input medias on file " & TmpMListFile & ",then give OK to proceed further",,"Attention Needed",48)
 
Set objtmplistFile = objFSO.OpenTextFile(TmpMListFile, ForReading)
 
Do Until objtmplistFile.AtEndOfStream
strMedLine = objtmplistFile.ReadLine
Svalue1 = StrComp(strMedLine,"")
if Svalue1 = 1 then
if mc < MailSC then
If mc = 0 then
bacthtoeject = strMedLine
mc = mc + 1
else
bacthtoeject = bacthtoeject & ":" & strMedLine
mc = mc + 1
 
end if
else
bacthtoeject = bacthtoeject & ":" & strMedLine
WScript.echo "Ejecting medias -" & bacthtoeject
   EjectCommand = "vmchange -res -multi_eject -sec 1 -single_cycle -w -verbose -rn " & rbnumber & " -rt TLD -rh " & strComputerName & " -ml " & bacthtoeject
'objShell.Run("%comspec% /c title Ejecting the tapes |" & EjectCommand), 1, TRUE
intButton3 = objShell.Popup(mc & " Medias has been ejected to Mail slots, Please move them and click one OK",,"Attention Needed",48)
WScript.sleep 6000
mc = 0
bacthtoeject = ""
End if
else
 
WScript.echo "Ejecting medias -" & bacthtoeject
EjectCommand = "vmchange -res -multi_eject -sec 1 -single_cycle -w -verbose -rn " & rbnumber & " -rt TLD -rh " & strComputerName& " -ml " & bacthtoeject
'objShell.Run("%comspec% /c title Ejecting the tapes |" & EjectCommand), 1, TRUE
intButton4 = objShell.Popup(mc & " Medias has been ejected to Mail slots, Please move them and click one OK",,"Attention Needed",48)
WScript.sleep 60000
mc = 0
bacthtoeject = ""
End if
Loop
 
Comments
Rami_Nasser1
Level 6
Partner Accredited Certified

Thanks for your effort on this script.Could you provide steps how to use it

Regards

Version history
Last update:
‎07-06-2013 12:05 AM
Updated by: