Video Screencast Help
Symantec Appoints Michael A. Brown CEO. Learn more.

Command for "Summary of All Policies"? - Deleting server from all policies it's in

Created: 03 May 2010 • Updated: 03 May 2010 | 12 comments

Hi everyone -

I have searched the community quite a bit on this issue but have not have any luck with previous posts.

I am looking to issue a command to delete the server (in question), from all policies it is in. For example, if I had to remove ServerA from the environment, I would want to remove all traces of ServerA from all policies.

Our Sr. Storage Engineer has pointed out that this can be done manually in the "Summary of All Policies" by filtering by Client Name and clicking delete.

Has anyone executed this via the command line or an API?

Thank you,
Matt Newman

Comments 12 CommentsJump to latest comment

Ed Wilts's picture

I'm sure that there are many, but this is a quickiy that works:

# bppllist -byclient <clientname> | awk '/^CLASS/{print $2}'

If this post helps you, please add a vote.

If this post answers your question, please mark it as a solution.  Thanks!
 

Nicolai's picture

grep {someserver} /usr/openv/netbackup/db/class/*/clients

then a 

bpplclients $POLICY -v -delete $CLIENT

for each instance where grep return exit code 0. The policy can be retrieved with a awk -F "/" '{ print $7 }'

Assumption is the mother of all mess ups.

If this post answered your'e qustion -  Please mark as a soloution.

stu52's picture

needs to be a script, just name this rmclient.sh and pass it the name of a client and it will then remove that client from all policies that it is in PLUS it will delete the policy if it is the only client in that policy:

#!/bin/sh

bppllist -byclient $CLIENT | grep "CLASS " |  awk '{print $2}' |
while read POLICY
do
        echo "bpplclients $POLICY -delete $CLIENT"
        bpplclients $POLICY -delete $CLIENT
        CLIENTS="`bpplclients $POLICY`"
        if [ -z "$CLIENTS" ]
        then
                echo "no clients remain in policy $POLICY, removing it......"
                bppldelete $POLICY
        else
                echo "other clients in policy $POLICY"
        fi
done

Remember.....Google is your friend!

Rich111's picture

Any ideas on scripting the removal of a client from all policies with NB running on a Windows server?

creany's picture

Morning Rich111

i had a tinker to write one for Windows.

@ECHO OFF
SET CLIENTNAME=xxxxxxxx.test.com.au
FOR /F  "tokens=3 delims= " %%i IN ('bppllist -byclient %CLIENTNAME% -U ^| find "Policy Name:"') DO ECHO Deleting Client %CLIENTNAME% from Policy %%i & bpplclients %%i -delete %CLIENTNAME%
SET CLIENTNAME=

it will echo on screen which policies the client will be deleted from and perform the deletion. just update the clientname variable and run on master /media server in the same NBU domain. i just tested it and it worked for me removing a test client from 3 policies.

creany

mattnewman's picture

Creany- Will that remove just the clients and leave the policys in tact if there are more than one hosts using a policy?

Thanks
Matt

Jay Son's picture

To Stu: Would the script look something like this?

#!/bin/sh

CLIENT=$1

bppllist -byclient $CLIENT | grep "CLASS " |  awk '{print $2}' |
while read POLICY
do
        echo "bpplclients $POLICY -delete $CLIENT"
        bpplclients $POLICY -delete $CLIENT
        CLIENTS="`bpplclients $POLICY`"
        if [ -z "$CLIENT" ]
        then
                echo "no clients remain in policy $POLICY, removing it......"
                bppldelete $POLICY
        else
                echo "other clients in policy $POLICY"
        fi
done

(the changes are in bold)
I added the "CLIENT=$1 to pass the server/client name (after the script name) and removed the "S" in "$CLIENTS"

Thanks

Nicolai's picture

It's a test to indicate that the variable  $CLIENT is NULL and does exist.

Assumption is the mother of all mess ups.

If this post answered your'e qustion -  Please mark as a soloution.

mattnewman's picture

After editing the file, it looks like the Windows script does delete the host. However, it does not delete an empty policy...

Any ideas if we're missing a necessary file?

Thanks

Matt