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
- Adding an NSH script to the Depot by using the BLCLI
- Adding an NSH script to the Depot by using 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_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
- Start NSH, authenticate, and connect to the Application Server as described in Setting-up-to-run-BLCLI-commands-in-an-NSH-shell.
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"- 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
- The first argument is a fully-qualified path to the Depot folder where you want to add the script:
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
- Start the BMC Server Automation Console.
- Expand the Depot folder, then right-click a depot subfolder and select New > NSH Script from the pop-up menu.
- 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.
- Click Next repeatedly to navigate through the remaining panels of the wizard, accepting all defaults.
- 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.