cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a VMware rule for client selection to an existing policy by command line?

Jim-90
Level 6

Anybody tried adding a VMware rule for client selection to an existing policy by the command line?

In the NBU 7.5 Commands Reference Guide there is appears to be now way of adding  VMware selection of clients using rules.  The command bpplclients normally handles this but doesn't look like it has this ability nor does any other command.

It should be a simple procedure because you can create a policy with a selection rule(s) and use that as an example and edit as required.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Jim-90
Level 6

In the end it was simple.  Copy a policy,  open up the Clients tab, click on the Advanced button and copy your query there.   After validation update other stuff in the policy as required.

 

Building the query was a small script where the input was a file with one column containg a list of VM machines by VM DNS name.    The script will generate a query line for every 50 clients based on mudulo arithmetic. 

Bash script :

i = 0
for name in $(cat $1); do
    m=$(($i % 50))  # where 50 is the max clients  
    if (( m == 0 )) ; then
       printf "\n\nvmware:/?filter=VMDNSName Contains \"%s\" " $name
    else
       printf "OR VMDNSName Contains \"%s\" " $name
    fi
   let i+=1
done

This way you can add 50 clients per policy, using their VMDNSName as the selection criteria. 

Relatively simple to change the criteria (VMDNSName) to something else and the number of objects in the policy, 50 changed to 5 then you end up with a query that is only selecting 5 objects.

Edit = updated max client number

View solution in original post

3 REPLIES 3

V4
Level 6
Partner Accredited

time for enhancement (PS should do trick on windows platform)

 

Mark_Solutions
Level 6
Partner Accredited Certified

The query is listed under selection list when you output a VMWare policy.

If you use (note that it needs lots of speech signs):

bpplinclude policyname -add "vmware:/?filter=Annotation Contains ""abc"""

It does add it to the policy - when viewed in the policy section of the console - but when you open the actual policy you cannot see it!

I don't have the facility to actually test if it works at the moment

Must be something along this track and maybe needs the bpplcleints command running too - have been able to get that type of input to work yet!

Jim-90
Level 6

In the end it was simple.  Copy a policy,  open up the Clients tab, click on the Advanced button and copy your query there.   After validation update other stuff in the policy as required.

 

Building the query was a small script where the input was a file with one column containg a list of VM machines by VM DNS name.    The script will generate a query line for every 50 clients based on mudulo arithmetic. 

Bash script :

i = 0
for name in $(cat $1); do
    m=$(($i % 50))  # where 50 is the max clients  
    if (( m == 0 )) ; then
       printf "\n\nvmware:/?filter=VMDNSName Contains \"%s\" " $name
    else
       printf "OR VMDNSName Contains \"%s\" " $name
    fi
   let i+=1
done

This way you can add 50 clients per policy, using their VMDNSName as the selection criteria. 

Relatively simple to change the criteria (VMDNSName) to something else and the number of objects in the policy, 50 changed to 5 then you end up with a query that is only selecting 5 objects.

Edit = updated max client number