10 Replies Latest reply on Jul 16, 2018 3:13 PM by Bill Robinson

    Need Help on removing RSCD user account on target host's by using BL Console

    Naveen kotha

      We have .nsh script to remove the rscd user account on target hosts.

      When I run target=`hostname`

      it will give server name with fqdn like sever.dev.com. Is there anyway that I can get only server name with out FQDN name.

        • 1. Re: Need Help on removing RSCD user account on target host's by using BL Console
          Bill Robinson

          We have .nsh script to remove the rscd user account on target hosts.

          what's in this script ?  what 'rscd user account' are you talking about - BladeLogicRSCD on a windows system or something else ?

           

          it will give server name with fqdn like sever.dev.com. Is there anyway that I can get only server name with out FQDN name.

          well there are a lot of different ways.  you can strip off the .dev.com from this output, you can use the uname command.  you can use some other command to get it and if this is a 'runscript' nsh script you can use the $NSH_RUNCMD_HOST variable.  but why do you need to strip off the domain from the server name ?

          • 2. Re: Need Help on removing RSCD user account on target host's by using BL Console
            Naveen kotha

            It is simple script it will select target hostname and delete that Blade logic RSCD user account on windows systems. I use command

             

            chapw -d $hostname.

             

            issues was with my script I have made some changes it was working Now. Thank you

            • 3. Re: Need Help on removing RSCD user account on target host's by using BL Console
              Naveen kotha

              Bill, ----(Now its not working)

              here is the nsh.script I'm using to disable RSCD user account on windows boxes. ( Because we have internal Auto principal and domain user accounts which we use to communicate target server from blade , As RSCD user account password Never Expires we need to disable that )

               

               

              if [[ "$1" == "" ]]; then

                 echo "Getting host name from command"

                 TARGET=`hostname`

              else

                 echo "Getting host name from argument"

                 TARGET=$1

              fi

               

              echo $TARGET

               

              whoami

              chapw -d "$TARGET"

               

               

              So some of server in blade console is configured as testap01.dev.com and testap02  , when I  try to run this it will pick only server with Full qualified domain name. I need to get pick server irrespective of weather it contains domain name or not.

              • 4. Re: Need Help on removing RSCD user account on target host's by using BL Console
                Bill Robinson
                So some of server in blade console is configured as testap01.dev.com and testap02  , when I  try to run this it will pick only server with Full qualified domain name. I need to get pick server irrespective of weather it contains domain name or not.

                if this is a 'runscript' nsh script you can use the $NSH_RUNCMD_HOST variable.

                • 5. Re: Need Help on removing RSCD user account on target host's by using BL Console
                  Naveen kotha

                  I'm not familiar with $NSH_RUNCMD_HOST variable, where i need to use this in that script? or while creating job? so this will print server name

                  • 6. Re: Need Help on removing RSCD user account on target host's by using BL Console
                    Bill Robinson

                    look in the man page of runscript/runcmd:

                     

                    r

                    uncmd(1)                   General Commands Manual                  runcmd(1)

                     

                     

                    NAME

                           runcmd - Run a Network Shell command on one or more hosts

                     

                     

                    SYNOPSIS

                           runcmd  [-v  -n  -p  n]  [-H header] [-NH] [-s | -c] [-d directory] [-f

                           file] [-h host1 ... hostn] [-e command1 ... commandn]

                     

                     

                           runscript [-v -n -p n] [-H header] [-NH] [-s | -c] [-d  directory]  [-f

                           file] [-h host1 ... hostn] [-e command1 ... commandn]

                     

                     

                    DESCRIPTION

                           The  programs runcmd and runscript let you run the same command on mul‐

                           tiple machines. The difference between the two is that runcmd  executes

                           a shell command, while runscript runs the given Network Shell script on

                           each machine.

                     

                     

                           Depending on what action you are currently performing, you may want  to

                           know  which  host  you  are  dealing with. To this end, the environment

                           variable NSH_RUNCMD_HOST is set for each sub-command that is run.  Fur‐

                           thermore the  environment variable NSH_RUNCMD_DIR is set indicating the

                           current Network Shell path.

                    so NSH_RUNCMD_HOST will evaluate to the name of the target as bsa sees it, not whatever hostname you resolve.  and afaik you need the name registered in bsa so that connection goes through the nsh proxy, which is the only way you can remove the BladeLogicRSCD account.

                    • 7. Re: Need Help on removing RSCD user account on target host's by using BL Console
                      Naveen kotha

                      Hi Bill, I have made changes but the job is working fine, but falling on some of server with the error , any idea about this error

                       

                      • 8. Re: Need Help on removing RSCD user account on target host's by using BL Console
                        Bill Robinson

                        can you attach the entire job run log and your script ?

                        if you manually try and run the chapw command (when using a nsh configured to use a nsh proxy) against the target what happens ?

                        • 9. Re: Need Help on removing RSCD user account on target host's by using BL Console
                          Naveen kotha

                          I'm not sure how to use NSH_RUNCMD_HOST command and where it has to be used, here is the script I'm using

                          if [[ "$1" == "" ]]; then

                              echo "Check if server exits in Blade"   

                          else

                              echo "Getting host name from argument"

                              TARGET=$1

                          fi

                          echo $TARGET

                          whoami

                          chapw -d "$TARGET"

                           

                          In this Script $1 is parameter which is used as HOST ( which will give server name how it is added to blade logic console )

                           

                          output of this script when it is success , I check on target it is removing Bladelogic RSCD user  account.

                          and , i don't see any option to attach file to this blog.  (to attach job logs)

                          • 10. Re: Need Help on removing RSCD user account on target host's by using BL Console
                            Bill Robinson

                            if it's a type 1 scrip then it's going to cd to the target first, and since you are using a nsh proxy, connect through that.  so it looks like nsh is having a problem connecting to your nsh proxy server on whatever appserver picked up the wit that failed for this job.  in the job run log you should see a message like 'executing work item thread for job xxx server yyy on appserver zzz' - find out what appserver ran the wit for the problem target and look in the appserver log around that time and see if there are any useful errors. 

                             

                             

                             

                             

                             

                             

                             

                            and , i don't see any option to attach file to this blog.  (to attach job logs)

                            advanced editor