03-28-2012 03:45 AM
hi all ,
i have a simple query regarding scripting enviroment
windows 2003 rs
nbu 6.5.5
i have more then 800 tapes with the assign time i want to deassign them
i want to make a simple script on windows server 2003 rs
but it is giving me error
C:\Program Files\Veritas\NetBackup\bin\admincmd>C:\Program Files\Veritas\NetBack
up\bin\admincmd\bpexpdate -d 0 -m 0098L4 -justmedia
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m A120L1 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0000L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0002L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0007L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0008L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0011L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0012L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0014L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0015L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0016L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0021L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0025L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0027L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0031L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0033L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0035L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0036L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0040L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0041L4 -justmedia
C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0043L4 -justmedia
Solved! Go to Solution.
03-28-2012 04:20 AM
DO NOT RUN THIS COMMAND WITH THE -justmedia option. You WILL cause catalog inconsistancies.
Please confirm WHY you are running the bpexpdate command, and WHY you are wanting to use the -justmedia option.
This is 'unsupported' and should ONLY be run when advised to do so by Technical Support.
To answer the question, it is not working as you need "'s
C:\"Program Files"\Veritas\NetBackup\bin\admincmd>C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0098L4 -justmedia
The answer is actually given to you when you ran the command.
Martin
03-28-2012 03:54 AM
You might need to put it in double quotes because of the space in "Program Files". The other thing you can try in your script is to change to the directory at the beginning of the script and then run the bpexpdate commands. Example:
cd "C:\Program Files\Veritas\NetBackup\bin\admincmd\"
bpexpdate -d 0 -m A120L1 -justmedia
....
bpexpdate -d 0 -m 0043L4 -justmedia
Here you do not have the C:\Program Files\Veritas\NetBackup\bin\admincmd\ path in front of every bpexpdate command.
03-28-2012 04:05 AM
Tapes are assigned for a good reason...
Why do you need to manually expire/deassign them?
03-28-2012 04:20 AM
DO NOT RUN THIS COMMAND WITH THE -justmedia option. You WILL cause catalog inconsistancies.
Please confirm WHY you are running the bpexpdate command, and WHY you are wanting to use the -justmedia option.
This is 'unsupported' and should ONLY be run when advised to do so by Technical Support.
To answer the question, it is not working as you need "'s
C:\"Program Files"\Veritas\NetBackup\bin\admincmd>C:\Program Files\Veritas\NetBackup\bin\admincmd\bpexpdate -d 0 -m 0098L4 -justmedia
The answer is actually given to you when you ran the command.
Martin
03-28-2012 04:26 AM
Agree with Marianne - be carful with this - you are removing all of those backups from NetBackup
You command will also prompt you for every tape asking if you are sure.
Is there a reason for you using the -justmedia switch?
If you are sure however then a far easier way to do this is with 2 files, a bat and a txt.
So the first is called expiry.bat and the second called tapes.txt - put them both in the same directory (anywhere)
The tapes.txt is just the list of mediaIDs one per line - so pasted straight from the GUI or whereever you have got you list from.
The expiry.bat contains (all on one line):
for /f %%a in (tapes.txt) do "C:\Program Files\veritas\netbackup\bin\admincmd\bpexpdate" -m %%a -d 0 -host mediaservername -justmedia -force
If they are owned by mutiple media servers you will need to have a tapes.txt for each one (media1tapes.txt etc.) and just repeat the lines in the bat file referencing each text file with each media servers name.
Hope this helps