02-16-2014 07:52 PM
I need a script that runs bpimmedia and displays client, media id, media server, and kbyte.
The media ID must begin with "V". ( only interested in Virtual Tapes I can't run this from the GUI because the total output is too large to display
( GUI abends).
Thanks in advance
Solved! Go to Solution.
02-17-2014 09:29 AM
This may give you what you want but feel free to edit it to suit
You will need to edit any netbackup paths and i am assuming you are doing this on a Windows platform or have a Windows Media Server from which to run it.
So on the Master (or Media) create a C:\images\ directory.
In there create two file - images.bat and images.vbs
Edit the images.bat file and paste in the following (editing the installation path to match yours - you can also edit the bpimmedia command if you wish the output to be displayed differently):
cd c:
cd c:\images\
del /Q final_list.txt
"c:\program files\veritas\netbackup\bin\admincmd\bpmedialist" -l>c:\images\medialist.txt
c:\images\images.vbs
for /f %%a in (c:\images\vtapes.txt) do "c:\program files\veritas\netbackup\bin\admincmd\bpimmedia" -mediaid %%a -l>>c:\images\final_list.txt
pause
Edit the images.vbs file and paste in:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\images\medialist.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
arrFields = Split(strLine, " ")
If Left(arrFields(0),1)="V" Then
strContents = strContents & arrFields(0) & vbCrlf
End If
Loop
objFile.Close
Set objFile = objFSO.CreateTextFile("C:\images\vtapes.txt")
objFile.Write strContentsa
objFile.Write strContents
objFile.Close
Run the images.bat file and it will churn away - first it pipes out a list of your tapes, analyses that to pin down the V* tapes, then pipes out the bpimmedia for each of those tapes.
Sure you can play with this if you want it to display it slightly differently but hopefully it is a starting point for you
Your results appear in the final_list.txt file.
Hope this helps
02-17-2014 09:29 AM
This may give you what you want but feel free to edit it to suit
You will need to edit any netbackup paths and i am assuming you are doing this on a Windows platform or have a Windows Media Server from which to run it.
So on the Master (or Media) create a C:\images\ directory.
In there create two file - images.bat and images.vbs
Edit the images.bat file and paste in the following (editing the installation path to match yours - you can also edit the bpimmedia command if you wish the output to be displayed differently):
cd c:
cd c:\images\
del /Q final_list.txt
"c:\program files\veritas\netbackup\bin\admincmd\bpmedialist" -l>c:\images\medialist.txt
c:\images\images.vbs
for /f %%a in (c:\images\vtapes.txt) do "c:\program files\veritas\netbackup\bin\admincmd\bpimmedia" -mediaid %%a -l>>c:\images\final_list.txt
pause
Edit the images.vbs file and paste in:
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\images\medialist.txt", ForReading)
Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
arrFields = Split(strLine, " ")
If Left(arrFields(0),1)="V" Then
strContents = strContents & arrFields(0) & vbCrlf
End If
Loop
objFile.Close
Set objFile = objFSO.CreateTextFile("C:\images\vtapes.txt")
objFile.Write strContentsa
objFile.Write strContents
objFile.Close
Run the images.bat file and it will churn away - first it pipes out a list of your tapes, analyses that to pin down the V* tapes, then pipes out the bpimmedia for each of those tapes.
Sure you can play with this if you want it to display it slightly differently but hopefully it is a starting point for you
Your results appear in the final_list.txt file.
Hope this helps
02-18-2014 01:05 PM
Thanks for your help. I will try this today