Here is the complete code snippet. The Script will add a virtual device called “TapeDrive” when it runs for the first time. The script will also assign the a value to it. You have to schedule this script to run. Let me know if this works for you. Make sure the path I have is correct...
Sub Main()
Dim N
Dim MyTape
Dim Results
Dim Cap
Dim dvRef
set objShell= CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("C:\Progra~1\nsr\bin\nsrmm") 'full path of the nsrmm
Do Until objExecObject.StdOut.AtEndOfStream
Results = Results & objExecObject.StdOut.Readline()
Loop
hs.WriteLog "Debug", Results
N = split(Trim(Results)," ")
Set objExecObject = objShell.Exec("C:\Progra~1\nsr\bin\mminfo.exe -a -r written,%used " & N(3)) 'full path of the nsrmm
Do Until objExecObject.StdOut.AtEndOfStream
Cap = Cap & objExecObject.StdOut.Readline()
Loop
N = split(Trim(Cap),"(%)")
dvRef = hs.GetDeviceRefByName("TapeDrive" )
if dvRef = -1 then
set dv = hs.NewDeviceEx("TapeDrive" )
dv.hc = "z"
dv.dc = "15" 'change this if this code is already taken
dv.dev_type_string ="Virtual"
end if
hs.SetDeviceStringByName "TapeDrive",N(1),true
hs.WriteLog "Debug", Cap
Set objShell = Nothing
End Sub
Sub Main()
Dim N
Dim MyTape
Dim Results
Dim Cap
Dim dvRef
set objShell= CreateObject("WScript.Shell")
Set objExecObject = objShell.Exec("C:\Progra~1\nsr\bin\nsrmm") 'full path of the nsrmm
Do Until objExecObject.StdOut.AtEndOfStream
Results = Results & objExecObject.StdOut.Readline()
Loop
hs.WriteLog "Debug", Results
N = split(Trim(Results)," ")
Set objExecObject = objShell.Exec("C:\Progra~1\nsr\bin\mminfo.exe -a -r written,%used " & N(3)) 'full path of the nsrmm
Do Until objExecObject.StdOut.AtEndOfStream
Cap = Cap & objExecObject.StdOut.Readline()
Loop
N = split(Trim(Cap),"(%)")
dvRef = hs.GetDeviceRefByName("TapeDrive" )
if dvRef = -1 then
set dv = hs.NewDeviceEx("TapeDrive" )
dv.hc = "z"
dv.dc = "15" 'change this if this code is already taken
dv.dev_type_string ="Virtual"
end if
hs.SetDeviceStringByName "TapeDrive",N(1),true
hs.WriteLog "Debug", Cap
Set objShell = Nothing
End Sub
Comment