Important

   

This space contains documentation for TrueSight Server Automation 8.9.03 and the later service packs for 8.9. For earlier releases, see BMC Server Automation 8.9.

Adding the NSH script to the Depot

After you have written a script, you need to add it to the Depot. You can add the NSH script to the Depot by using the BLCLI or the BMC Server Automation Console:

Before you begin

Copy the script that was described in the previous section into a text editor and save it on your local computer with the SetServerPropertyValue.nsh file name.

blcli_connect
blcli_execute Server listAllServers
blcli_storeenv SERVERS
for SERVER in ${SERVERS}
do
blcli_execute Server setPropertyValueByName ${SERVER} MY_PROPERTY "some Value"
done

Adding an NSH script to the Depot by using the BLCLI

  1. Start NSH, authenticate, and connect to the Application Server as described in Setting up to run BLCLI commands in an NSH shell.
  2. Use the NSHScript addNSHScriptToDepotByGroupNamecommand to add the script to the Depot.

    MY_NSH_PROMPT% blcli_execute NSHScript addNSHScriptToDepotByGroupName
      "/MySub-Folder" 1 "/c/myScripts/SetServerPropertyValue.nsh" "SetServerPropertyValue"
      "SetServerPropertyValue"
    
  3. The command returns the DBKey of the newly added NSHscript object DBKey:SDepotObjectModelKeyImpl:2000123-1-2004601):
    DBKey:SDepotObjectModelKeyImpl:2000123-1-2004601MY_NSH_PROMPT%
    Observe the following guidelines when using this command:
    • The first argument is a fully-qualified path to the Depot folder where you want to add the script:
      "/MySub-Folder"
      This argument does NOT include the word Depot. Use this technique when you specify fully-qualified paths to subfolders that reside under any of the top level folders — Jobs, Components, and so forth. Never start the path with the top level folder name (for example, Jobs). Instead. start the path with a forward slash / followed by the name of the subfolder directly under the top level folder. You can specify multiple nested sub-folders, for example:
      "/MySub-Folders/MidWest/Illinois/Chicago"
    • The third argument is an NSH style path to the script.
      "/c/myScripts/SetServerProertyValue.nsh"
      Examples of how to use this syntax in different environments:
      Local file (Windows): /c/temp/myScript.nsh
      Local file (UNIX): /tmp/myScript.nsh
      Remote file on machine with host name myRemoteHost: Start the path with double slashes and the hostname, for example:
      (Windows) //myRemoteHost/c/temp/myScript.nsh
      (UNIX) //myRemoteHost/tmp/myScript.nsh

Where to go from here

Now that the script is in the Depot, you need to create and run an NSH Script Job. This job runs your script. For information on how to do this, see Creating and running a job that uses the NSH script.

Adding an NSH script to the Depot by using the BMC Server Automation Console

  1. Start the BMC Server Automation Console.
  2. Expand the Depot folder, then right-click a depot subfolder and select New > NSH Script from the pop-up menu.
  3. When the NSH Script wizard appears, fill in the following values:
    • Name: SetServerPropertyValue
    • File Location: Click Browse to navigate to the location where you stored SetServerPropertyValue.nsh.
    • Accept all the other defaults.
  4. Click Next repeatedly to navigate through the remaining panels of the wizard, accepting all defaults.
  5. Click Finish to exit the wizard.
    Your newly added script now appears in your depot sub-folder.

Where to go from here

Now that the script is in the Depot, you need to create and run an NSH Script Job. This job runs your script. For information on how to do this, see Creating and running a job that uses the NSH script.

Was this page helpful? Yes No Submitting... Thank you

Comments