Practice: Embedded Scripts
Objective
Use an embedded script to create a folder.
Instructions
Create a Script in the Repository
- In Library >> Administration, select Scripts.
- Click the Add button on the toolbar.
- In the Name textbox, enter Make_Directory.
- In the Type textbox, choose Command Shell.
- In the Description enter Create a new folder.
- In the Script file section type the following (this is the example script we will run in OpCon):
mkdir %1
- Click Save.
Create the Schedule
- From the Home tab, select Studio.
- Click the Add button on the toolbar.
- In the Schedule Name textbox, enter Script Practice Schedule.
- In the Documentation textbox, enter This is a Training Schedule.
- In the Schedule Build and Maintenance frame, mark the Auto Build checkbox.
- Set
7
for the number of days in advance for Auto Build. - Set
1
for the number of days to Auto Build. - Mark the Auto Delete checkbox.
- Set
7
for the number of days to Auto Delete. - Click the Save button.
Create the Embedded Script Job
- In Studio, with Script Practice Schedule selected, click the Add Job button on the side menu.
- In the Name textbox, enter
Create New Folder
. - In the Job Type drop-down list, select Windows.
- In the Machine Selection section, select the desired machine from the Machines or Machine Group drop down. .
- In the General section, select the desired user from the User Id drop down.
- In the Job Action drop-down list, select Embedded Script.
- In the Script drop-down list, select the Make_Directory.
- Leave the Version as LATEST (X).
- In the Runner drop-down menu, select Command Shell.
- In the Arguments textbox, type the following,
“C:\Backup\[[$SCHEDULE DATEYYYYMM]]”
- Click Save.
- Click the Lock icon in the upper right-hand corner.
- Scroll to the Frequency sections and create or use desired Frequency.
- Add Documentation and then click Save.
Build Schedule
- Build the Script Practice Schedule for today (Be sure to build as Released).
- Once the Job completes successfully, verify that the folder was created in Windows File Explorer.