Martin
That worked, I will look into Cygwin
and perl for compatibility issues for the future but I still need approval to
install Cygwin on our servers. Thanks for your help.
Daniel Jimenez
Data Protection Team
From: Martin, Jonathan
[mailto:JMARTI05 AT intersil DOT com]
Sent: Monday, September 28, 2009 10:51 AM
To: Jimenez, Daniel; veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] Bpplist Policy Script
When you run it from the command line run use cscript.exe i.e.
"cscript.exe nameofscript.vb" - this will send the output to the
command window (by default) versus the pop-ups. Windows Script comes in
two varieties... cscript.exe for command line stuff and wscript.exe for windows
script stuff. If you just run a .vb it defaults to the application type
in windows which is normally wscript.exe. wscript's standard output is a
pop-up window / alert.
Here's a version that outputs to a file:
strOutputFile = "c:\temp\NBU-PolicyReporter.txt"
set objWshShell = CreateObject("WScript.Shell")
set objExec = objWshShell.Exec("D:\Program
Files\VERITAS\NetBackup\bin\admincmd\bppllist.exe -allpolicies")
set objFileSystem = CreateObject("Scripting.fileSystemObject")
set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
do while not objExec.StdOut.AtEndOfStream
output = Split(objExec.StdOut.ReadLine(), " ")
If output(0) = "CLASS" Then objOutputFile.WriteLine vbNewLine &
"Policy: " & output(1) End If
If output(0) = "RES" Then objOutputFile.WriteLine "Policy
Storage Unit: " & output(1) End If
If output(0) = "SCHED" Then objOutputFile.WriteLine "Schedule:
" & output(1) End If
If output(0) = "SCHEDRES" Then objOutputFile.WriteLine "Storage
Unit: " & output(1) End If
loop
objOutputFile.Close
Normally I write all my Netbackup scripts in Perl so they are (more
or less) compatible with all versions of Netbackup. I don't mind writing
a little windows script to keep my skill set from rusting, but I would
definitely suggest you move to perl or use cygwin (::profuse vomiting::) so you
are more compatible with the "Netbackup Community".
-Jonathan
From: Jimenez, Daniel [mailto:Daniel.Jimenez AT owb DOT com]
Sent: Monday, September 28, 2009 1:21 PM
To: Martin, Jonathan; veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] Bpplist Policy Script
Jonathan
Would it be possible to output
the data to a file?
Daniel Jimenez
Data Protection Team
From: Jimenez, Daniel
Sent: Monday, September 28, 2009 10:12 AM
To: 'Martin, Jonathan'; veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] Bpplist Policy Script
Jonathan
I am getting the right
information but in pop up windows, is there something I need to do in order to
stop these pop ups from coming up?
Daniel Jimenez
Data Protection Team
From: Martin, Jonathan
[mailto:JMARTI05 AT intersil DOT com]
Sent: Monday, September 28, 2009 8:07 AM
To: Jimenez, Daniel; veritas-bu AT mailman.eng.auburn DOT edu
Subject: RE: [Veritas-bu] Bpplist Policy Script
My understanding of awk syntax has never been very good but here's
a windows script that will give you similar output (I think). Save as a
.vbs and run from the command line. You might need to change the location
of your bppllist.exe command.
set objWshShell = CreateObject("WScript.Shell")
set objExec = objWshShell.Exec("D:\Program
Files\VERITAS\NetBackup\bin\admincmd\bppllist.exe -allpolicies")
do while not objExec.StdOut.AtEndOfStream
output = Split(objExec.StdOut.ReadLine(), " ")
If output(0) = "CLASS" Then Wscript.Echo vbNewLine &
"Policy: " & output(1) End If
If output(0) = "RES" Then Wscript.Echo "Policy Storage Unit:
" & output(1) End If
If output(0) = "SCHED" Then Wscript.Echo "Schedule: " &
output(1) End If
If output(0) = "SCHEDRES" Then Wscript.Echo "Storage Unit:
" & output(1) End If
loop
-Jonathan
From: veritas-bu-bounces AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-bounces AT mailman.eng.auburn DOT edu] On Behalf Of Jimenez,
Daniel
Sent: Friday, September 25, 2009 8:03 PM
To: veritas-bu AT mailman.eng.auburn DOT edu
Subject: [Veritas-bu] Bpplist Policy Script
I found the script below that pulls the policy and storage
device from Netbackup but it is for Unix and was wondering if anyone knows how
to translate this to Windows?
bppllist -allpolicies | awk `{
if ($1=="CLASS")
{c=$2;stu="";printf("\n%24s: ",c)}
if ($1=="RES" || $1=="SCHEDRES" ){
F=2
while($F!~/NULL/ && F<=NF)
{if($F!=stu){stu=$F;printf("%12s
",$F)};F++}
}
}END{printf("\n")}`