3 Replies Latest reply on Nov 30, 2011 9:10 AM by Paul Seager-Smith

    Smart Group for Windows Domain members

    Russ Todd

      Is there a easy way to create a smart group that will capture Windows serversa that are domain members vs those that are not?

        • 1. Smart Group for Windows Domain members

          I guess that the attribute you are looking for (for the server smart group condition) is in the servers' fully qualified name (FQ_HOST). You can also add a new property to Server class or use and use it in the server smart group condition (for example boolean IS_DOMAIN_MEMBER). in case you carete custom property, you'll probably need to set the value manually.

          • 2. Re: Smart Group for Windows Domain members
            Bill Robinson

            Yes – unfortunately there is not an intrinsic property to identify if the box is a domain member so you need to run a nsh script to look at the box and then set a server property – unless there is some existing attribute about the system already that bladelogic knows that would identify if the server is in a domain (fdqn suffix or something)

            • 3. Re: Smart Group for Windows Domain members
              Paul Seager-Smith

              We used the follwoing NSH code to set a custom property to give the domain role:


              # Set default domain role to unknown



              # If this is a Windows server, then we need to get the domain role

              if [ "$OS" = "Windows" ]


                        print "\nObtaining this server's Domain Role... "


                        # First of all we run a WMI command to get the domain role for the target server

                        DOMAINROLE=$(nexec $SERVER cmd /c "wmic computersystem get domainrole /value <NUL")

                        if [ -z "$DOMAINROLE" ]


                                  print "\nFailed to retrieve Domain Role from $SERVER"

                                  exit 1



                        # Extract the domain role number

                    eval $DOMAINROLE


                        # Now we convert the number returned to a string

                        case "$DomainRole" in

                                  0)          STR_DOMAIN_ROLE="Standalone Workstation"


                                  1)          STR_DOMAIN_ROLE="Member Workstation"


                                  2)          STR_DOMAIN_ROLE="Standalone Server"


                                  3)          STR_DOMAIN_ROLE="Member Server"


                                  4)          STR_DOMAIN_ROLE="Backup Domain Controller"


                                  5)          STR_DOMAIN_ROLE="Primary Domain Controller"


                                  *)          print "\nERROR:  Obtained invalid domain role value of [${DomainRole}], exiting..."

                                            exit 1





              if [ "$STR_DOMAIN_ROLE" = "Unknown" ]


                        print "\nDomain Role      [$STR_DOMAIN_ROLE] (this is normal for UNIX servers)"


                        print "\nDomain Role      [$STR_DOMAIN_ROLE]"



              # and store it in the server property

              blcli_execute Server setPropertyValueByName $SERVER _DOM_ROLE "$STR_DOMAIN_ROLE"

              if [ $? -ne 0 ]


                        print "\nFailed to set Domain Property _DOM_ROLE"

                        exit 2


              1 of 1 people found this helpful