4 Replies Latest reply on Jun 19, 2014 5:19 PM by Ben 10

    Edit smartgroup rule

    Ben 10

      Hi everyone,


      I'm trying to modify a rule in a smartgroup with blcli command.


      Exemple: I have a smartgroup named "Windows Server 2003" with the rule "Any Server Where OS_Version equals 2003".


      There's a way to modify the smargroup rule?


      I would like to know where I can find the blcli command to do this or if you have an exemple?



        • 1. Re: Edit smartgroup rule
          Bill Robinson

          It’s probably easier to clear the conditions and then re-create them.

          • 2. Re: Edit smartgroup rule
            Ben 10

            1- There's no blcli command to modify the condition in a smartgroup?


            2- Where I can found the blcli command to clear the condition and re-create?


            Thanks Bill!

            • 3. Re: Re: Edit smartgroup rule
              Yanick Girouard

              If this can help, here's a sample of a script I wrote to update a server smartgroup. You can probably adapt it for what you want to do, but the essential that you need is there:


              # This is an example
              # You must first create your server smartgroup and this will overwrite the conditions with a single "is one of" list of servers
              SERVER_LIST="server1 server2 server3"
              for s in $SERVER_LIST; do
              echo "List of servers: ${SERVERS}"
              blcli_execute Group getGroupByQualifiedName 5007 "/Path/To/SmartGroup"
              blcli_execute Utility storeTargetObject sgObject
              blcli_execute Condition createPropertyCondition "Class://SystemObject/Server" "NAME" "is one of" "[${SERVERS}]"
              blcli_execute Utility storeTargetObject conditionObject
              blcli_execute SmartGroup resetConditions NAMED_OBJECT=sgObject NAMED_OBJECT=conditionObject
              blcli_execute SmartGroup save NAMED_OBJECT=sgObject
              • 4. Re: Edit smartgroup rule
                Ben 10

                Thanks Yannick!


                I will try this!