Daniel_Braaf_197

How to automatically import script content from the O.S. into a Jobs Object?

Discussion created by Daniel_Braaf_197 on Feb 12, 2016
Latest reply on Feb 13, 2016 by Daniel_Braaf_197
Every now and then i get asked if there is a possibility to import script from the O.S. to a Job within Automic?

V11.2 offers some really nice new features that makes it easier to build such an automation. 

Before i start however, a little advertising for my training i am holding soon, this will be one of the topics i will be covering, so if you like what you read here, please come join my training session. Here the link with more information:

So here are my scripts that i have locally on my Windows machine where i have an Automic Agent installed:

rz2pyoi5y3c3.jpg





A powerhsell file, several SQL scripts, and 2 bat files. 

Here some example content they contain:

uc0lckvw4exm.jpg



In Automic i have 3 File-Events that watch over my autoconvert folder that contains my scripts:

 

08picr57mvud.jpg


If the folder contains scripts, the following Win-Job is triggered (batch file import example):

8pnowsxgnuaf.jpg

 


The script reads the file content into a process loop, then forms it into one big Variable named &JCL# (thanks to Variable length enhancement in V11). The Variable is then resolved into a deployment of the xml of the Job wich is stored in a storage Object.

The Post Script of the job Imports the XML back into Automic:

uzgidrbaz9ba.jpg


If we now navigate into our import folder there was a job created for each script that was found:

2cmdtme7zlm2.jpg



Lets have a look into our Batch Script import Job:

t03jxb1gdfwc.jpg


Interpreter Script such as Powershell can be importet directly into the external interpreter section:

dmimdi41813s.jpg


If you would rather have a function similar to an upload button, you can combine the Importjob with a prompset object


uxiao0xf4pq7.jpg


Hope this might be useful to some of you! Hope to see you in the training session!!

Outcomes