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

Re: VB Script for Legato Networker by Pegasus

Pegasus
Sun Jan 27 14:42:53 CST 2008


"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?



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?
>

Re: VB Script for Legato Networker by Jaco

Jaco
Mon Jan 28 15:09:06 CST 2008

This is the output from the legato command if it is checking for the current
loaded media in the tape drive. "sdlt320 tape BELdaily-001 mounted on
rd=bel-fs-01:\\.\Tape0, write enabled"

I need to feed this to the script to decide whether to prompt for a
different tape or to label the tape with the same label (also erase the
tape)



"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
>
>

Re: VB Script for Legato Networker by Pegasus

Pegasus
Mon Jan 28 15:31:23 CST 2008

Sorry, I do not have the time to wade through your whole script.
If you have a problem with a specific section then you should
post just that section and explain your difficulty.

If you need to pick up the console output generated by a program
that you invoke from within VB Script then you can do it like so:

Set ObjWshShell = WScript.CreateObject("WScript.Shell")
Set ObjExec = ObjWshShell.exec("%ComSpec% /c SomeProg.exe")
Do
wscript.echo "Output Line = " & ObjExec.StdOut.ReadLine
Loop Until ObjExec.StdOut.AtEndOfStream


"Jaco Niemand" <jaco_niemand@hotmail.co.uk> wrote in message
news:DCE44987-5A46-4497-AB2D-4D5C358CC7F8@microsoft.com...
> This is the output from the legato command if it is checking for the
> current loaded media in the tape drive. "sdlt320 tape BELdaily-001 mounted
> on rd=bel-fs-01:\\.\Tape0, write enabled"
>
> I need to feed this to the script to decide whether to prompt for a
> different tape or to label the tape with the same label (also erase the
> tape)
>
>
>
> "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
>>
>>



Re: VB Script for Legato Networker by Jaco

Jaco
Mon Jan 28 16:46:26 CST 2008

OK

Here is the first bit of the script. The rest of the script is suppose to do
exactly the same only with different tape drives.

So the first bit of script will look something like this:

Set WshShell = WScript.CreateObject("WScript.Shell")
Set ObjExec = WshShell.Exec("%ComSpec% /c nsrmm -v -f
rd=bel-fs-01:\\.\Tape0")
Do
WScript.Echo "Output Line = " & ObjExec.StdOut.ReadLine
Loop Until ObjExec.StdOut.AtEndOfStream

So how to I get the vbscript to tell legato to label the tape IF THE TAPE
THAT IS INSERTED HAS A LABEL OF BELdaily-001.

The output of legato will look something like "sdlt320 tape BELdaily-001
mounted on rd=bel-fs-01:\\.\Tape0, write enabled"



"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
>
>

Re: VB Script for Legato Networker by Pegasus

Pegasus
Mon Jan 28 17:16:46 CST 2008

Presumably like so:

Set WshShell = WScript.CreateObject("WScript.Shell")
Set ObjExec = WshShell.Exec("%ComSpec% /c nsrmm -v -f
rd=bel-fs-01:\\.\Tape0")
if UCase(ObjExec.StdOut.ReadLine)=UCase("BELdaily-001") then
{tell Legato to label the tape}
end if

You'll have to compose the Legato command yourself, of course.


> Loop Until ObjExec.StdOut.AtEndOfStream

"Jaco Niemand" <jaco_niemand@hotmail.co.uk> wrote in message
news:116EFB45-BA51-4A76-AEF2-545BE223E430@microsoft.com...
> OK
>
> Here is the first bit of the script. The rest of the script is suppose to
> do exactly the same only with different tape drives.
>
> So the first bit of script will look something like this:
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set ObjExec = WshShell.Exec("%ComSpec% /c nsrmm -v -f
> rd=bel-fs-01:\\.\Tape0")
> Do
> WScript.Echo "Output Line = " & ObjExec.StdOut.ReadLine
> Loop Until ObjExec.StdOut.AtEndOfStream
>
> So how to I get the vbscript to tell legato to label the tape IF THE TAPE
> THAT IS INSERTED HAS A LABEL OF BELdaily-001.
>
> The output of legato will look something like "sdlt320 tape BELdaily-001
> mounted on rd=bel-fs-01:\\.\Tape0, write enabled"
>
>
>
> "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
>>
>>



Re: VB Script for Legato Networker by Jaco

Jaco
Mon Jan 28 17:38:06 CST 2008

Ok,

I will modify my script accordingly and let you know the outcome.

Thanks

"Pegasus (MVP)" <I.can@fly.com.oz> wrote in message
news:#uLnlPgYIHA.5816@TK2MSFTNGP06.phx.gbl...
> Presumably like so:
>
> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set ObjExec = WshShell.Exec("%ComSpec% /c nsrmm -v -f
> rd=bel-fs-01:\\.\Tape0")
> if UCase(ObjExec.StdOut.ReadLine)=UCase("BELdaily-001") then
> {tell Legato to label the tape}
> end if
>
> You'll have to compose the Legato command yourself, of course.
>
>
>> Loop Until ObjExec.StdOut.AtEndOfStream
>
> "Jaco Niemand" <jaco_niemand@hotmail.co.uk> wrote in message
> news:116EFB45-BA51-4A76-AEF2-545BE223E430@microsoft.com...
>> OK
>>
>> Here is the first bit of the script. The rest of the script is suppose to
>> do exactly the same only with different tape drives.
>>
>> So the first bit of script will look something like this:
>>
>> Set WshShell = WScript.CreateObject("WScript.Shell")
>> Set ObjExec = WshShell.Exec("%ComSpec% /c nsrmm -v -f
>> rd=bel-fs-01:\\.\Tape0")
>> Do
>> WScript.Echo "Output Line = " & ObjExec.StdOut.ReadLine
>> Loop Until ObjExec.StdOut.AtEndOfStream
>>
>> So how to I get the vbscript to tell legato to label the tape IF THE TAPE
>> THAT IS INSERTED HAS A LABEL OF BELdaily-001.
>>
>> The output of legato will look something like "sdlt320 tape BELdaily-001
>> mounted on rd=bel-fs-01:\\.\Tape0, write enabled"
>>
>>
>>
>> "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
>>>
>>>
>
>