4 Replies Latest reply on Jul 26, 2012 8:34 AM by Iain Taylor

    Execute against BLCLI command

    Iain Taylor

      Hello all, as part of the post provisioning of a windows server I am putting together a post provisioning batch file that will install all the software required. Because we have two different country's using the same server build they have seperate post install build requirements, as such I have created a batch job which calls a NSH script which will determine which of the post provisioning batch jobs to use. The logic works and it determines the correct batch job use but it fails because it is not supplying the host name of the server to run the new batch job against.

       

      below is the script that I have put together so far, this adds a target to the batch job and then executes, the only issue is that it does add the target server into the Servers/Server Groups section of the batchjob. this is obviously at an early stage and I need to add some additional error checking in.

       

      I guess my question has two options that I can think of

      1. Is there a blcli command that I could add to the script that would run an execute against "SERVER_NAME" ?

       

      2. Is there a blcli command that I could add to the end of the script that would then remove the "SERVER_NAME" from the batchjob?

       

       

      ######################################################################################################################

       

       

      #!/bin/nsh

       

      _VRF=$1

      SERVER_NAME=$2

       

      case $_VRF in

            UK)

            BATCHJOB_NAME="Test Post-Provisioning"

            BATCHJOB_GROUP="/Windows/Build Management/Provisioning"

            echo "UK Post Provisioning"

            ;;

            CH)

            BATCHJOB_NAME="Test Post-Provisioning CH"

            BATCHJOB_GROUP="/Windows/Build Management/Provisioning"

            echo "CH Post Provisioning"

            ;;

            *)

            echo "VRF not supported"

            exit 1

            ;;

      esac

      echo $BATCHJOB_NAME

      echo $BATCHJOB_GROUP

      echo $SERVER_NAME

       

      blcli_execute BatchJob getDBKeyByGroupAndName "$BATCHJOB_GROUP" "$BATCHJOB_NAME"

      blcli_execute BatchJob addNamedServerToJobByJobDBKey "$BATCHJOB_DBKEY" "$SERVER_NAME"'

      blcli_storeenv BATCHJOB_DBKEY

       

      echo $BATCHJOB_DBKEY

       

      blcli_execute BatchJob executeJobAndWait $BATCHJOB_DBKEY

       

      echo "Post Provisioning completed"

       

      exit

       

       

      #########################################################################################################################

       

      Many thanks

       

      Iain