BSA: BladeLogic Server Automation: How to read Smart Groups within BLCLI

Version 1

    This document contains official content from the BMC Software Knowledge Base. It is automatically updated when the knowledge article is modified.


    BladeLogic Server Automation Suite


    BMC BladeLogic Server Automation Suite



    How can one read Smart Group member results from the command line via BLCLI?




    Legacy ID:KA321200


    1) Get the Object Type ID for the Smart Group in question;
    2) Use the result from above to get values.


    Example 1: getting a list of members from a Job Smart Group:


    blcli_execute Group groupNameToId $qualifiedGroupName 5006
    blcli_storeenv GroupId
    blcli_execute Job findAllHeadersByGroup $GroupId
    blcli_execute SJobHeader getName
    blcli_execute Utility setTargetObject
    blcli_execute Utility listPrint


    Example 2: getting a list of patch names from a Windows Catalog Smart Group:


    GroupName="/Patch Catalogs/WindowsCatalog/SmartGroup"
    blcli_execute Group groupNameToId "$GroupName" 5017
    blcli_storeenv GroupId
    blcli_execute DepotObject findAllHeadersByGroup $GroupId
    blcli_execute SDepotObjectHeader getName
    blcli_execute Utility setTargetObject
    blcli_execute Utility listPrint
    blcli_storeenv PatchNames


    Example 1: 5006 is the Type ID for a Job Smart Group, whereas a normal Job Group is Object Type ID 5005.
    Example 2: 5017 is the Type ID for Windows Catalog Smart Group.
    You can use the same syntax to look up other Smart Groups:


    5006 - Job Smart Group
    5007 - Server Smart Group
    5012 - Depot Smart Group
    5015 - Component Smart Group
    5016 - Template Smart Group
    5017 - Windows Patch Catalog Smart Group
    5018 - Red Hat Patch Catalog Smart Group
    5019 - Solaris Patch Catalog Smart Group
    5024 - Other Linux Patch Catalog Smart Group
    5039 - Patch Smart Group (in BladeLogic 7.x)
    5044 - PM Device Smart Group


    Note that 5017 through 5024 and 5044 are exclusive to BladeLogic Server Automation 8.x and will not work in 7.x.
    -- this will give you all Type IDs
    SQL: select * from object_type


    BMC constantly develops simpler BLCLI syntax; here are some alternatives to the BLCLI commands above:


    blcli_execute JobGroup groupNameToId $qualifiedGroupName
    blcli_execute SmartDepotGroup groupNameToId $qualifiedGroupName
    blcli_execute ComponentGroup groupNameToId $qualifiedGroupName


    Refer to BLCLI Help for more information.

    Related Products:  
    1. BMC BladeLogic Server Automation Suite


    Article Number:


    Article Type:

    Solutions to a Product Problem

      Looking for additional information?    Search BMC Support  or  Browse Knowledge Articles