Skip to main content

Practice: Embedded Scripts

Objective

Use an embedded script to create a folder.

Instructions

Create a Script in the Repository

  1. In Library >> Administration, select Scripts.
  2. Click the Add button on the toolbar.
  3. In the Name textbox, enter Make_Directory.
  4. In the Type textbox, choose Command Shell.
  5. In the Description enter Create a new folder.
  6. In the Script file section type the following (this is the example script we will run in OpCon):

mkdir %1

  1. Click Save.

Create the Schedule

  1. From the Home tab, select Studio.
  2. Click the Add button on the toolbar.
  3. In the Schedule Name textbox, enter Script Practice Schedule.
  4. In the Documentation textbox, enter This is a Training Schedule.
  5. In the Schedule Build and Maintenance frame, mark the Auto Build checkbox.
  6. Set 7 for the number of days in advance for Auto Build.
  7. Set 1 for the number of days to Auto Build.
  8. Mark the Auto Delete checkbox.
  9. Set 7 for the number of days to Auto Delete.
  10. Click the Save button.

Create the Embedded Script Job

  1. In Studio, with Script Practice Schedule selected, click the Add Job button on the side menu.
  2. In the Name textbox, enter Create New Folder.
  3. In the Job Type drop-down list, select Windows.
  4. In the Machine Selection section, select the desired machine from the Machines or Machine Group drop down. .
  5. In the General section, select the desired user from the User Id drop down.
  6. In the Job Action drop-down list, select Embedded Script.
  7. In the Script drop-down list, select the Make_Directory.
  8. Leave the Version as LATEST (X).
  9. In the Runner drop-down menu, select Command Shell.
  10. In the Arguments textbox, type the following, “C:\Backup\[[$SCHEDULE DATEYYYYMM]]”
  11. Click Save.
  12. Click the Lock icon in the upper right-hand corner.
  13. Scroll to the Frequency sections and create or use desired Frequency.
  14. Add Documentation and then click Save.

Build Schedule

  1. Build the Script Practice Schedule for today (Be sure to build as Released).
  2. Once the Job completes successfully, verify that the folder was created in Windows File Explorer.

Video Walkthrough

Embedded Scripts