Re: VB Script for Legato Networker by Jaco
Jaco
Mon Jan 28 15:05:51 CST 2008
OK, don't laugh at this, but this is what I've got sofar. Like I said I am a
total newbie to scripting.
The variable for example BELdaily is suppose to be the value that is return
by the legato command for the tape that is suppose to be in the drive for
that day. In this case Monday as the label is BELdaily-001
Let me know if you need more information
Any help will be much appreciated.
Option Explicit
On Error Resume Next
Dim BELdaily, BIRdaily, CAMdaily, COLdaily, DUBdaily, EDIdaily, EXEdaily,
GLAdaily, LEEdaily, Mandaily, NORdaily, WshShell
BELdaily = "sdlt320 tape BELdaily-001 mounted on rd=bel-fs-01:\\.\Tape0,
write enabled"
BIRdaily = "sdlt320 tape BIRdaily-001 mounted on rd=bir-fs-01:\\.\Tape0,
write enabled"
CAMdaily = "sdlt320 tape CAMdaily-001 mounted on rd=cam-fs-01:\\.\Tape0,
write enabled"
COLdaily = "sdlt320 tape COLdaily-001 mounted on rd=col-fs-01:\\.\Tape0,
write enabled"
DUBdaily = "sdlt320 tape DUBdaily-001 mounted on rd=dub-fs-01:\\.\Tape0,
write enabled"
EDIdaily = "sdlt320 tape EDIdaily-001 mounted on rd=edi-fs-01:\\.\Tape0,
write enabled"
EXEdaily = "sdlt320 tape EXEdaily-001 mounted on rd=exe-fs-01:\\.\Tape0,
write enabled"
LEEdaily = "sdlt320 tape LEEdaily-001 mounted on rd=lee-fs-01:\\.\Tape0,
write enabled"
MANdaily = "sdlt320 tape MANdaily-001 mounted on rd=man-fs-01:\\.\Tape0,
write enabled"
NORdaily = "sdlt320 tape NORdaily-001 mounted on rd=nor-fs-01:\\.\Tape0,
write enabled"
Set WshShell = WScript.CreateObject("wscript.shell") 'Create Wscript Object
to be used with methods.
If "nsrmm -v -f rd=bel-fs-01:\\.\Tape0" = BELdaily Then 'Compare label of
current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=bel-fs-01:\\.\Tape0
BELdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Belfast - Insert BELdaily-001!" 'Prompt for correct tape if
wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=bir-fs-01:\\.\Tape0" = "BIRdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=bir-fs-01:\\.\Tape0
BIRdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Birminham - Insert BIRdaily-001!" 'Prompt for correct tape
if wrong or no tape is loaded in drive.
End If
If "nsrmm -v -f rd=cam-fs-01:\\.\Tape0" = "CAMdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=cam-fs-01:\\.\Tape0
CAMdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Cambridge - Insert CAMdaily-001!" 'Prompt for correct tape
if wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=col-fs-01:\\.\Tape0" = "COLdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=col-fs-01:\\.\Tape0
COLdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Coleraine - Insert COLdaily-001!" 'Prompt for correct tape
if wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=dub-fs-01:\\.\Tape0" = "DUBdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=dub-fs-01:\\.\Tape0
DUBdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Dublin - Insert DUBdaily-001!" 'Prompt for correct tape if
wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=edi-fs-01:\\.\Tape0" = "EDIdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=edi-fs-01:\\.\Tape0
EDIdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Edinburgh - Insert EDIdaily-001!" 'Prompt for correct tape
if wrong or no tape is loaded in drive.
End If
If "nsrmm -v -f rd=exe-fs-01:\\.\Tape0" = "EXEdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=exe-fs-01:\\.\Tape0
EXEdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Exeter - Insert EXEdaily-001!" 'Prompt for correct tape if
wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=gla-fs-01:\\.\Tape0" = "GLAdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=gla-fs-01:\\.\Tape0
GLAdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Glasgow - Insert GLAdaily-001!" 'Prompt for correct tape if
wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=lee-fs-01:\\.\Tape0" = "LEEdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=lee-fs-01:\\.\Tape0
LEEdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Leeds - Insert LEEdaily-001!" 'Prompt for correct tape if
wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=man-fs-01:\\.\Tape0" = "MANdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=man-fs-01:\\.\Tape0
MANdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Manchester - Insert MANdaily-001!" 'Prompt for correct tape
if wrong or no tape is loaded in drive.
End if
If "nsrmm -v -f rd=man-fs-01:\\.\Tape1" = "MANdaily-001a" Then 'Compare
label of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=man-fs-01:\\.\Tape1
MANdaily-001a") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Manchester - Insert Mandaily-001a!" 'Prompt for correct tape
if wrong or no tape is loaded in drive.
End If
If "nsrmm -v -f rd=nor-fs-01:\\.\Tape0" = "NORdaily-001" Then 'Compare label
of current loaded tape against variable.
WshShell.Exec ("nsrmm -m -l -b Daily -y -f rd=nor-fs-01:\\.\Tape0
NORdaily-001") 'Execute Legato command if correct tape is loaded in drive.
Else
WScript.Echo "Norwich - Insert NORdaily-001!" 'Prompt for correct tape if
wrong or no tape is loaded in drive.
End If
"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:#f3MyUSYIHA.4808@TK2MSFTNGP05.phx.gbl...
>
> "Jaco Niemand" <jaco_niemand@hotmail.co.uk> wrote in message
> news:0D045366-B2AE-42E8-8850-83290CB3002F@microsoft.com...
>> Hi there
>>
>> I am a total newbie to VBScripting and was wondering if someone can help
>> out here.
>>
>> I am trying to write a vbscript that I can run to label all my tapes that
>> are inserted into backup drives in all our Regional Office. (about 13
>> Offices)
>>
>> Labeling, mounting tapes, etc can all be done with the Legato command
>> line, But I would like to automate all this.
>>
>> The only thing is I want legato to check what tape is currently loaded in
>> the drive and then if it is the right media to label it. If it is not the
>> right label it must prompt you for the correct tape.
>>
>> I know how to check the current loaded media with the legato commands.
>>
>> So in short:
>>
>> I have the vbscript to tell legato to check what media is loaded. If it
>> is the right media then to label the tape with a label. And it is not the
>> right media to prompt your for the right media to be inserted into the
>> backup drive.
>>
>> Please can someone help.
>>
>> If you need any additional information please let me know.
>>
>> Thanks
>
> How does Legato tell the calling VB Script which tape is loaded?
>