Announcement

Collapse
No announcement yet.

Need script help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    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
    Last edited by ssk; October 12, 2009, 11:46 AM.

    Comment


      #47
      SSK.... This is perfect!!! Thank you very much.

      I really appreciated you taking the time to help me out.

      Modified it slightly to give me
      Tape Usage: 5322 MB 13% (Written/Used)

      Happy Thanks Giving!

      Robert
      HS3PRO 3.0.0.500 as a Fire Daemon service, Windows 2016 Server Std Intel Core i5 PC HTPC Slim SFF 4GB, 120GB SSD drive, WLG800, RFXCom, TI103,NetCam, UltraNetcam3, BLBackup, CurrentCost 3P Rain8Net, MCsSprinker, HSTouch, Ademco Security plugin/AD2USB, JowiHue, various Oregon Scientific temp/humidity sensors, Z-Net, Zsmoke, Aeron Labs micro switches, Amazon Echo Dots, WS+, WD+ ... on and on.

      Comment

      Working...
      X