cancel
Showing results for 
Search instead for 
Did you mean: 

VBScript with available_media.cmd

mich2w
Level 3
Hi,

I've written a vbscript that gets the output from available_media.cmd, then uses some string manipulation to report on how many full tapes are in the library for particular pools.  An email is then sent to the relevant site requesting tapes to be rotated based on this information.  I hope this is not too confusing!  The relevant part of the vbscript that runs the available_media command shown below.

  Set objShell = CreateObject("WScript.Shell")
  Set objScriptExec = objShell.Exec("available_media.cmd")
  strPools = UCase(objScriptExec.StdOut.ReadAll)

The important point is this:  When I run the script from normal command prompt it runs fine, but when attempting from scheduled task it doesn't run available_media.cmd.  The string is always returned as null.  I've tried some inventive ways to attempt to workaround this, like attempting to run available_media.cmd from a batch file that outputs to a text file (idea being the script can then read from this text fil).  Unfortunately the same thing occurs, it runs fine when just running the .bat file but not when it is scheduled.  eg.

cmd /c "available_media.cmd >d:\scripts\maintenance\test\file.txt",1,True

So on to my question(s). 

1.  Is there a way to run the available_media cmd from scheduled task?
2.  If answer to above is no, is there another netbackup command that will output the volume pools with the status of the included tapes?

I've tried to run 'bpmedialist -p volume_pool' but get an error: Could not obtain report from host XYZ, database system error

Any help or ideas on this much appreciated!

Thanks

Mic
3 REPLIES 3

Andy_Welburn
Level 6
but looking at this from a UNIX scripting point of view, does the script 'know' where the available_media command is? In UNIX you would either have to set a PATH variable to (essentially) search for executables, or run the command using the absolute path e.g. /usr/openv/netbackup/bin/goodies/available_media.

mich2w
Level 3
Don't worry about replying to this - issue has been solved by using the AT command instead of scheduled task GUI.  eg.

AT 08:00 /every:M,F cmd /c "d:\scripts\maintenance\vol_Tapes.vbs >> d:\scripts\maintenance\voltapes.txt"

mich2w
Level 3
Just saw the email above my last post.  I didn't need to point to the direct location of available_media.cmd since the Goodies directory is included in the path.