Video Screencast Help

NBU6.0 - Exclude List for windows clients - how to deploy an excluded directory to all clients?

Created: 11 Jul 2007 • Updated: 21 May 2010 | 22 comments
Hi guys,
I realized that 1.5GB/client were used by SMS cached files, and I have been told there is no need to back it up.
 
Does anyone have an idea on how to deploy the exclusion smartly?
like a script maybe?
 
exclusion: C:\WINDOWS\system32\CCM\Cache
target: all windows clients
all policies, all schedules...
 
Thanks a lot for your help.

Comments 22 CommentsJump to latest comment

sdo's picture
Hi Alex,
Take a "bpplclients -allunique -L" listing.  Iterate through that, and for each Windows box then;
Take a "bpgetconfig -M <clientname> EXCLUDE" listing to a temp file, then;
Do a "find -i "EXCLUDE = <yourpath>" tmp.txt" to see if your file exclusion already exists;
If it doesn't exist then append your new exclusion to the tmp file and;
Then use "bpsetconfig -h <clientname> tmp.txt" to post the updated list of exclusions to the client;
Then iterate next entry from the list of clients.
Regards,
Dave.
 
P.S. Will you be running this from a Windows host?
Would you like a DOS example script?
Alexandre Rappoport's picture
Hi Dave,
thanks a lot for your reply.
Yes I would be running it from a windows host, and I need to spend some time dev the script, as we don't have a vbs or dos guru!
If you have an  example, that would help, definately.
 
And I am sure it will help a lot of us, as with time, people forget what was excluded etc...
Thanks
 
J.H Is gone's picture
if you use the gui (netbackup console) you could do it their too.
 
go to host properties
 clients
choose a bunch of servers that you want to add the exclude to
right click and get properties for all the severs you have highlighted
when open choose Windows Client and Exclude Lists
click ADD
for policy choose all
then put your path in the Files/Directories field.
and add and close
it will add it to all the clients you opened.
now ok to get it to apply
 

I don't have to know how to spell....I work on Unix.
NetBackup 7.0.1 - AIX & Windows

Wes T. Gator's picture
Excellent suggestion J.!  I never noticed that you could do that before.  That would be even easier than using a script. 
Alexandre Rappoport's picture
Yep, I use the GUI way for single to small groups of clients.
but we are talking about 150 windows clients, and knowing how the gui can get unstable, I rather not spend 2 hours each time I want to deploy an exclusion.
While with a generic script, you can apply that to SQL servers or any other groups like this...
 
Cheers
Omar Villa's picture
Excelent posts, I always want it to know how to perform this.
 
Thanks.

Omar Villa

Netbackup Expert

Twiter: @omarvillaNBU

 

sdo's picture
Allexandre is right.  Although the admin GUI is supposed to be able to add exclusions to many clients in one go, I've been told by old hands never to do more than about ten at a time - plus there's always that niggling thought that a client's exclude list may have been corrupted... ;)
 
I do have a Windows DOS script that I can post, but I'd like to finish testing it first.  It's about 400+ lines long.  Does anyone know if attachments can be posted in these threads?
Stumpr2's picture
Disregard my previous entry. I was attempting to do a cut/paste and nothing became of it.
 
What I was trying to do was show the SRC button. But I guess I need a little more practice.

VERITAS ain't it the truth?

Stumpr2's picture
Code:
for i in `cat /tmp/hostslist`do echo $isudo bpgp from $i /usr/openv/netbackup/bp.conf /tmp/bpconf/$i_bp.confdone


 

VERITAS ain't it the truth?

sdo's picture
Now 483 lines (added comments and white space)...
Still testing - don't hold your breath...
 
Summary of first run:
 
14:23:39
14:23:39  Run totals are:
14:23:39    Clients found:     131
14:23:39    No ping:           9
14:23:39    Clients ignored:   118
14:23:39    Clients updated:   4
14:23:39    Clients failed:    0
14:23:39
14:23:39  Script started:      14:14:54
14:23:39  Script completed:    14:23:39
 
sdo's picture
Details of DOS based script (for use/run on Windows based admin consoles, media servers or master server) which can be used to apply additions and removals to the exclusion lists of clients.
 
Tested on:
NetBackup v5.1 MP6
Windows 2000 Pro SP4, Windows 2000 Adv Srvr SP4
 
At the moment the crucial line to actually apply changes is commented out, so I believe the script is safe to run/test.  However, do so at your own risk.  Hopefully some of you will try it.
 
Some usage notes:
1) Copy the script to a separate folder on the master, and name the script as "exclusions.bat".
2) Create a plain text file named "exclusions.add" containing a list of folder/files paths to be added to a client's exclusion list.
3) Create a plain text file named "exclusions.rem" containing a list of folder/files paths to be removed from a client's exclusion list.
4) If processing a specific list of clients by name, the create a simple list of clients in a plain text file named "exclusions.nam".
 
5) Run the script.
6) Select whether you want to process clients by name, or by platform or by O/S.
7) Clients with policy based or policy+schedule based exclusion lists are ignored.
 
 
The script creates a datetime stamped sub-folder to hold all working files.  The script creates a ".LOG" file, and a ".CSV" summary file of actions taken, and the list of clients at the time ".LIS".  For all clients the original exclusion list will be saved as "<client-name>.CUR" and if the script determines that additions/removals are applicable then there will also be a ".NEW" (unsorted) updated list of exclusions - and also a ".SRT" (sorted) updated list of exclusions.
Chuck Stevens's picture

J.Hinchcliffe wrote:
if you use the gui (netbackup console) you could do it their too.
 
go to host properties
 clients
choose a bunch of servers that you want to add the exclude to
right click and get properties for all the severs you have highlighted
when open choose Windows Client and Exclude Lists
click ADD
for policy choose all
then put your path in the Files/Directories field.
and add and close
it will add it to all the clients you opened.
now ok to get it to apply
 


Note: Do not do this with the Java console!  It'll ruin all your Exclusion lists.

 
Alexandre Rappoport's picture
yes Yes YES
I am interested by the script
If you come in Sydney Australia, Free beer for you !!
 
cheers
Sreekanth_Adari's picture
Hi,
 
Even I need the script for exclude list . Please send it to me tooo
 
 
With Regards
-Sreekanth
 

Sreekanth

sdo's picture
Misuse of this script will definitely ruin exclusion lists on clients.
Use at your risk.
I take no reponsibility.
Posted in two halves.
 
First half:
Code:
@echo offsetlocal enabledelayedexpansionREM ***************************************************************************************************************REM * File:  exclusions.batREM * Purpose: To add to, and remove from, exclusion list on multiple NetBackup clients.REM *REM * Vers Date  Who DescriptionREM * ---- ----  --- -----------REM * v0.01 18-JUL-2007 DR Initial version to loop around clients.REM * v0.02 19-JUL-2007 DR Check client ping/is alive, and check client name.REM * v0.03 19-JUL-2007 DR Functionality to add exclusions.REM * v0.04 19-JUL-2007 DR Functionality to remove exclusions.REM * v0.05 19-JUL-2007 DR Run data/log folder is now date and time stamped.REM * v0.06 19-JUL-2007 DR Ignore clients with policy based and/or policy+schedule based exclusions.REM * v0.07 19-JUL-2007 DR Determine date format (for our US cousins).REM * v0.08 19-JUL-2007 DR If nothing to add or remove then just save/list the exclusion lists.REM * v0.09 19-JUL-2007 DR If there are changes to possibly make, get user to confirm action.REM * v0.10 19-JUL-2007 DR If aborting then the shell has to exit, otherwise it will return to caller.REM * v0.11 19-JUL-2007 DR Save a copy of ".add" and ".rem" files in the run folder.REM * v0.12 19-JUL-2007 DR Added script "notes" just below.REM * v0.13 19-JUL-2007 DR Added some more comments in the code.REM * v0.14 19-JUL-2007 DR Added processing by separate name list, or by platform, or by O/S.REM * v0.15 19-JUL-2007 DR Write a csv summary file.REM * v0.16 19-JUL-2007 DR Process removals first.REM ***************************************************************************************************************set z_vers=v0.16REM ***************************************************************************************************************REM * Changes to possibly make:REM * 1) (Waiting for suggestions...)REM ***************************************************************************************************************REM * Notes about this script:REM * 1) This script must live in a path with no spaces in any folder name.REM * 2) This script file name must not have any spaces either.REM * 3) The '.add' and '.rem' files must not have 'EXCLUDE = ' in them.REM * 4) This script is case INsensitive to the exclusions to be added and/or removed, i.e. if "*:\TEMP" is inREM *    the remove file, then "*:\Temp" can be removed from a client.REM ***************************************************************************************************************REM * Tested on:REM * - NBU ES v5.1 MP6, Windows XP Pro SP2, master/media/admin.REM * - NBU ES v5.1 MP6, Windows 2000 Adv Srvr SP4 MSCS cluster, master/media/admin.REM ***************************************************************************************************************REM Get the full path and drive/folder and name of this script at run time...set z_full=%~dpnx0set z_path=%~dp0set z_name=%~n0REM Determine the date format (dd/mm/yyyy) or (mm/dd/yyyy)...set z_tmp=!z_path!!z_name!.tmpif exist "!z_tmp!" del "!z_tmp!"echo+|date>"!z_tmp!"for /f "tokens=1,2,3,4,5 skip=1" %%a in (!z_tmp!) do (  set z_date_format=%%e)if exist "!z_tmp!" del "!z_tmp!"REM Break the date and time into a time stamp suitable for use in a folder/path specification...set z_date=!date!set z_time=!time:~0,8!if "!z_date:~3,1!"==" " (  set z_date_day=!z_date:~0,3!  set z_date_aa=!z_date:~4,2!  set z_date_bb=!z_date:~7,2!  set z_date_yyyy=!z_date:~10,4!) else (  set z_date_aa=!z_date:~0,2!  set z_date_bb=!z_date:~3,2!  set z_date_yyyy=!z_date:~6,4!)if "!z_date_aa:~0,1!"==" " set z_date_aa=0!z_date_aa:~-1!if "!z_date_bb:~0,1!"==" " set z_date_bb=0!z_date_bb:~-1!if /i "!z_date_format:~1,2!"=="dd" (  set z_date_dd=!z_date_aa!  set z_date_mm=!z_date_bb!) else (  set z_date_dd=!z_date_bb!  set z_date_mm=!z_date_aa!)set z_time_hh=!z_time:~0,2!set z_time_mm=!z_time:~3,2!set z_time_ss=!z_time:~6,2!if "!z_time_hh:~0,1!"==" " set z_time_hh=0!z_time_hh:~-1!set z_stamp=!z_date_yyyy!!z_date_mm!!z_date_dd!-!z_time_hh!!z_time_mm!!z_time_ss!REM All files relevant to this run/use of this script will be stored in here...set z_run=!z_path!!z_name!-!z_stamp!\if not exist "!z_run!" mkdir "!z_run!"REM These two files are amended by the user before running this script...set z_add=!z_path!!z_name!.addset z_nam=!z_path!!z_name!.namset z_rem=!z_path!!z_name!.remREM These three files are part of the "run" data set...set z_csv=!z_run!!z_name!.csvset z_log=!z_run!!z_name!.logset z_lis=!z_run!!z_name!.lisREM Save the time this script started...set z_started=!time:~0,8!REM Write a header to the log file...call :log ""call :log "********************************"call :log "Script:    !z_full!"call :log "Version:   !z_vers!"call :log "Run Date:  !date!  !time:~0,8!"call :log "Log file:  !z_log!"call :log "Computer:  !computername!"call :log "Username:  !username!"REM Write a header to the CSV file...echo Client,Platform,OS,Action,Time >> "!z_csv!"REM Test to see whether the admin binaries are reachable, i.e. in the DOS PATH...bpgetconfig >NUL 2>NULif     "!errorlevel!"=="9009" goto :noadminbinariesif not "!errorlevel!"=="0"    goto :badadminREM Show and count the exclusions that are to be added...Call :log ""Call :log "Listing exclusions to be added..."if not exist "!z_add!" goto :noaddfileset z_to_add=0for /f "tokens=*" %%a in (!z_add!) do (  call :log "  %%a"    set /a z_to_add+=1)call :log "There are `!z_to_add!` exclusion(s) to be added..."REM show and count the exclusions that are to be removed...Call :log ""Call :log "Listing exclusions to be removed..."if not exist "!z_rem!" goto :noremfileset z_to_rem=0for /f "tokens=*" %%a in (!z_rem!) do (  call :log "  %%a"  set /a z_to_rem+=1)call :log "There are `!z_to_rem!` exclusion(s) to be removed..."REM Are we actually intending to change anything, or just list the current exclusions...set z_method=ANYset z_platform=ANYset z_os=ANYCall :log ""call :log "Determining script actions..."set z_updates=yesif !z_to_add!==0 (  if !z_to_rem!==0 (    set z_updates=no  ))if "!z_updates!"=="no" (  call :log "Both the add and remove files are empty, no updates will take place, clients will be listed/saved only...") else (  call :log "Script will apply changes to clients..."  call :asksure  if /i "!z_sure!"=="yes" (    call :log "User has selected to update *ALL* Windows clients..."    call :askmethod  ) else (    goto :scram  ))REM If we're going to process by a separate file of individually named clients then check that the file exists, and has entries...if /i "!z_method!"=="name" (  Call :log ""  Call :log "Listing clients to be individually updated..."  if not exist "!z_nam!" goto :nonamfile  set z_to_nam=0  for /f "tokens=*" %%a in (!z_nam!) do (    call :log "  %%a"    set /a z_to_nam+=1  )  if "!z_to_nam!"=="0" (    call :log "There are no clients listed in the file `!z_nam!`, script cannot continue..."    goto :end  ) else (    call :log "There are `!z_to_nam!` individual clients to be processed..."  ))REM Did the use choose to exit...if /i "!z_method!"=="exit"   goto :scramif /i "!z_platform!"=="exit" goto :scramif /i "!z_os!"=="exit"       goto :scramREM Log what we're about to do...call :log ""call :log "Processing options selected are:"call :log "  Method, by:    !z_method!"call :log "  Platform:      !z_platform!"call :log "  O/S:           !z_os!"call :log "  Updates:       !z_updates!"REM Save the intended additions and removals to the datetime stamped run folder...if exist "!z_add!" copy "!z_add!" "!z_run!" >nulif exist "!z_nam!" copy "!z_nam!" "!z_run!" >nulif exist "!z_rem!" copy "!z_rem!" "!z_run!" >nulREM Fetch a list of all unique clients that exist within all policies...Call :log ""call :log "Now listing clients from policies..."bpplclients -allunique -l > "!z_lis!"set z_cnt=0for /f "tokens=*" %%a in (!z_lis!) do (set /a z_cnt+=1)if "!z_cnt!"=="0" goto :emptyclientsfilecall :log "There were`!z_cnt!` unique clients listed from the policies..."REM Zeroise some totalling counters...set z_found=0set z_noping=0set z_ignored=0set z_updated=0set z_failed=0if /i "!z_method!"=="name"     call :process-by-nameif /i "!z_method!"=="platform" call :process-by-platformif /i "!z_method!"=="os"       call :process-by-osREM Show the run summary...set z_completed=!time:~0,8!call :log ""call :log ""call :log "Run totals are:"call :log "  Clients found:     !z_found!"call :log "  No ping:           !z_noping!"call :log "  Clients ignored:   !z_ignored!"call :log "  Clients updated:   !z_updated!"call :log "  Clients failed:    !z_failed!"call :log ""call :log "Script started:      !z_started!"call :log "Script completed:    !z_completed!"REM The bitter end...:endecho+pauseexit/b


 

sdo's picture
...second half:
 
Code:
REM ******************************************REM *** MAJOR SUBROUTINE...REM ******************************************:process-by-namefor /f "tokens=1" %%a in (!z_nam!) do (  set z_client_name=%%a  set z_client_platform=  set z_client_os=  set /a z_found+=1  call :log ""  Call :log "Processing client `!z_client_name!`..."  set z_action=  call :process_exclusions  call :csv)goto :eof:process-by-platformfor /f "tokens=1,2,3,4" %%a in (!z_lis!) do (  set z_client_name=%%b  set z_client_platform=%%c  set z_client_os=%%d  if /i "!z_client_platform!"=="!z_platform!" (    set /a z_found+=1    call :log ""    Call :log "Processing client `!z_client_name!`..."    set z_action=    call :process_exclusions    call :csv  ))goto :eof:process-by-osfor /f "tokens=1,2,3,4" %%a in (!z_lis!) do (  set z_client_name=%%b  set z_client_platform=%%c  set z_client_os=%%d  if /i "!z_client_os!"=="!z_os!" (    set /a z_found+=1    call :log ""    Call :log "Processing client `!z_client_name!`..."    set z_action=    call :process_exclusions    call :csv  ))goto :eof:process_exclusionsset z_cur=!z_run!!z_client_name!.curset z_new=!z_run!!z_client_name!.newset z_srt=!z_run!!z_client_name!.srtif exist "!z_cur!" del "!z_cur!"if exist "!z_new!" del "!z_new!"if exist "!z_srt!" del "!z_srt!"call :log "Pinging client..."call :isaliveif /i "!z_isalive!"=="no" (  set /a z_noping+=1  set z_action=Does not ping  call :log "Client does not ping..."  goto :eof)call :log "Checking client name..."call :checknameif /i "!z_badname!"=="yes" (  set /a z_ignored+=1  set z_action=Unexpected real client name  call :log "Ignoring because client has an unexpected `CLIENT_NAME` of `!z_real_client_name!`..."  goto :eof)REM Fetch the current exclusions...call :log "Fetching current exclusions..."bpgetconfig -M !z_client_name! EXCLUDE > "!z_cur!"if !errorlevel! neq 0 (  set /a z_ignored+=1  set z_action=Failed to fetch exclusions  call :log "Ignoring client, failed to fetch current exclusions..."  goto :eof)REM If we're not updating, no need to carry on...if not "!z_updates!"=="yes" (  set /a z_ignored+=1  set z_action=In list mode, no changes made  call :log "Client exclusions listed, no changes made..."  goto :eof)REM Now check to make sure that there are no policy and/or policy+schedule exclusions...call :log "Checking whether policy and/or policy+schedule based exclusions exist..."set z_ignore=nofor /f "tokens=1,2,3" %%a in (!z_cur!) do (  set z_exclude=%%c  if /i "!z_exclude:~0,6!"=="class:" set z_ignore=yes  if /i "!z_exclude:~0,6!"=="sched:" set z_ignore=yes)if /i "!z_ignore!"=="yes" (  set /a z_ignored+=1  set z_action=Client has policy or schedule exclusions  call :log "Client has policy and/or policy+schedule based exclusions, ignoring client..."  goto :eof)REM We can't use the "find" command as this might result in a partial match - Bad puppy...REM Now process the removals...REM First we need to determine if any excludes actually currently exist...call :log "Processing removals..."set z_current=0set z_removed=0for /f "tokens=*" %%a in (!z_cur!) do (  if /i not "%%a"=="EXCLUDE" (set /a z_current+=1))for /f "tokens=*" %%a in (!z_cur!) do (  set z_exclude=%%a  set z_matched=no  for /f "tokens=*" %%b in (!z_rem!) do (    if /i "!z_exclude!"=="EXCLUDE = %%b" set z_matched=yes  )  if /i "!z_matched!"=="yes" (    call :log "WILL REMOVE:          !z_exclude!"    set /a z_removed+=1  ) else (    if not "!z_current!"=="0" (      call :log "Leaving client with:  !z_exclude!"      echo !z_exclude!>>"!z_new!"    )  ))if "!z_removed!"=="0" (  call :log "No removals made...") else (  call :log "Made `!z_removed!` removals...")REM Now process the additions...set z_added=0call :log "Processing additions..."if "!z_to_add!"=="0" (  call :log "There are no additions to action...") else (  for /f "tokens=*" %%a in (!z_add!) do (    set z_exclude=EXCLUDE = %%a    set z_matched=no    for /f "tokens=*" %%b in (!z_cur!) do (      if /i "!z_exclude!"=="%%b" set z_matched=yes    )    if /i "!z_matched!"=="yes" (      call :log "Client already has:   !z_exclude!"    ) else (      call :log "WILL ADD:             !z_exclude!"      echo !z_exclude!>>"!z_new!"      set /a z_added+=1    )  ))if "!z_added!"=="0" (  call :log "No additions made...") else (  call :log "Made `!z_added!` additions...")REM Do we think we're actually changing anything...if "!z_added!"=="0" (  if "!z_removed!"=="0" (    set /a z_ignored+=1    set z_action=No need to update    call :log "There are no changes to make, ignoring client..."    goto :eof  ))REM I'm sure the client will appreciate this...sort "!z_new!" /o "!z_srt!"REM Show what the exclusions will now be...Call :log "New exclusions will be..."type "!z_srt!"REM *** Uncomment the next line to make actual updates to clients...REM bpsetconfig -h !z_client_name! "!z_srt!"if !errorlevel! neq 0 (  set /a z_failed+=1  set z_action=UPDATE FAILED  call :log "Failed to update client, status `!errorlevel!`..."  goto :eof)set /a z_updated+=1set z_action=Updated OKcall :log "Client updated ok..."goto :eofREM ******************************************REM *** MINOR SUBROUTINES...REM ******************************************REM Determine method, i.e. by name, platform or OS...:askmethodset z_method_def=EXITset z_method=call :log ""set z_prompt=!time:~0,8!  Select method for selecting clients to be updated —  (NAME,PLATFORM,OS,EXIT) [!z_method_def!]  : echo !z_prompt!>>"!z_log!"set /p  z_method=!z_prompt!if /i "!z_method!"==""         set z_method=!z_method_def!if /i "!z_method!"=="name"     goto :eofif /i "!z_method!"=="platform" goto :askplatformif /i "!z_method!"=="os"       goto :askosif /i "!z_method!"=="exit"     goto :eofgoto :askmethod:askplatformset z_platform_def=EXITset z_platform=call :log ""set z_prompt=!time:~0,8!  Select platform of clients to be updated –  (ALPHA,PC,RS6000,SOLARIS,EXIT) [!z_platform_def!]  : echo !z_prompt!>>"!z_log!"set /p  z_platform=!z_prompt!if /i "!z_platform!"==""         set z_platform=!z_platform_def!if /i "!z_platform!"=="Alpha"    goto :eofif /i "!z_platform!"=="PC"       goto :eofif /i "!z_platform!"=="RS6000"   goto :eofif /i "!z_platform!"=="Solaris"  goto :eofif /i "!z_platform!"=="exit"     goto :eofgoto :askplatform:askosset z_os_def=EXITset z_os=call :log ""call :log "Possible O/S names are any one of the following:"Call :log "  AIX4.3"call :log "  Solaris2.6, Solaris7, Solaris8, Solaris9, Solaris10"call :log "  VMS"call :log "  Windows2000, WindowsXP, WindowsNET"call :log ""set z_prompt=!time:~0,8!  Select O/S of clients to be updated ˜  (one of above, or EXIT) [!z_os_def!]  : echo !z_prompt!>>"!z_log!"set /p  z_os=!z_prompt!if /i "!z_os!"==""            set z_os=!z_os_def!if /i "!z_os!"=="AIX4.3"      goto :eofif /i "!z_os!"=="Solaris2.6"  goto :eofif /i "!z_os!"=="Solaris7"    goto :eofif /i "!z_os!"=="Solaris8"    goto :eofif /i "!z_os!"=="Solaris9"    goto :eofif /i "!z_os!"=="Solaris10"   goto :eofif /i "!z_os!"=="VMS"         goto :eofif /i "!z_os!"=="Windows2000" goto :eofif /i "!z_os!"=="WindowsXP"   goto :eofif /i "!z_os!"=="WindowsNET"  goto :eofif /i "!z_os!"=="exit"        goto :eofgoto :askosREM Write a summary line to the CSV file...:csvecho !z_client_name!,!z_client_platform!,!z_client_os!,!z_action!,!time:~0,8! >> "!z_csv!"goto :eofREM Ask the use if they are sure they want to update any/all clients...:asksure:set z_sure_def=NOset z_sure=call :log ""set z_prompt=!time:~0,8!  Are you sure you want to update *ALL* Windows clients ™  (YES,NO) [!z_sure_def!]  : echo !z_prompt!>>"!z_log!"set /p z_sure=!z_prompt!if /i "!z_sure!"==""    set z_sure=!z_sure_def!if /i "!z_sure!"=="no"  goto :eofif /i "!z_sure!"=="yes" goto :eofgoto :asksureREM Ping a client name and see if it's alive, N.B. DMZ clients will thus be ignored...:isaliveset z_isalive=nofor /f "tokens=1" %%a in ('ping !z_client_name! -n 1 -w 100') do (  if /i "%%a"=="reply" (    set z_isalive=yes    goto :eof  )  if /i "%%a"=="request" (goto :eof)  if /i "%%a"=="unknown" (goto :eof))goto :eofREM You never know with some hosts files or DNS, so let's make sure the client is who we think it is...:checknameset z_badname=yesfor /f "tokens=1,2,3" %%a in ('bpgetconfig -M !z_client_name! CLIENT_NAME') do (set z_real_client_name=%%c)if /i "!z_client_name!"=="!z_real_client_name!" set z_badname=nogoto :eofREM Display a line and write to the log file...:logset z_time=!time:~0,8!if "!z_time:~0,1!"==" " set z_time=0!z_time:~1,7!echo !z_time!  %~1echo !z_time!  %~1 >> "!z_log!"goto :eofREM ******************************************REM *** ERRORS (from main)...REM ******************************************:noadminbinariescall :log "This machine does not appear to have NetBackup admin binaries in the environment PATH..."goto :end:badadmincall :log "Failed to query self using bpgetconfig..."goto :end:noaddfilecall :log "Cannot find file of exclusions to add named `!z_add!`..."goto :end:nonamfilecall :log "Cannot find list/file of individually named clients `!z_nam!`..."goto :end:noremfilecall :log "Cannot find file of exclusions to remove named `!z_rem!`..."goto :end:emptyclientsfilecall :log "The `bpplclients` command did not find any Windows based clients..."goto :end:scramcall :log "User has selected to exit this script..."goto :endREM ******************************************REM *** ABORTS/SEVERE/FATAL...REM ******************************************REM All the following and serious enough to warrant aborting the script session/box...:abortcall :log "Script cannot continue, and will abort this DOS session..."echo+pauseexit


 

Stumpr2's picture
 
could you port that over to UNIX shell for me?
 
 

VERITAS ain't it the truth?

sdo's picture
Hmmm, great code posting window... it interprets plain text...  sighs...
 
Change the smileys to   <colon><p>, i.e. a ":"  and a "p" - but of course without the quotes... sighs...
 
 
Anyway, once you've stitched the two halves together, and before you run it... some notes...
 
 
The script has three input files:
1) exclusions.add         containing the list add (if not already present)
2) exclusions.rem        what to remove
3) exclusions.nam        list of individually named clients to update
 
 
Behaviour:
1) The script saves the original client exclusion lists in case you need to go back manually.
2) All runs generate new yyyymmdd-hhmmss date stamped sub-folders containing log of actions, pre and post changes, and copies of the three input files, so you can always go back and look at what you told the script to do.
3) When run the, script asks whether to continue, before...
4) ...then asks on what basis to process clients (by platform type, O/S type, or by name (i.e. from the ".nam" file mentioned above))...
5) No support is offered, and I'll decide whether I answer questions about it.
6) Change it as you see fit, I just ask that you keep the version table intact, and update it if you change it.
7) Clients with policy and/or policy+schedule based exclusion lists are ignored, you'll have to update those by hand as usual.
 
Have fun,
Regards,
Dave.
sdo's picture
No "ksh" I'm afriad.  Sorry.
 
Also, I forgot to repeat that the script won't actually make any changes to clients, as the "bpsetconfig" line is commented out with a REM. If you really want to try to update many clients, then remove the REM before "bpsetconfig".
 
Alex,
I you want to add your "...CCM\cache" exclusion to all Windows clients, then you might want to run the script a few times, as, if you have Win2000 clients then it's quite likely that there %windir% will be C:\WINNT\, whereas it's typically C:\WINDOWS\ fpr WInXP and 2003.

Message Edited by sdw303 on 08-10-200712:35 AM