question

jansiranikrishnan-1796 avatar image
0 Votes"
jansiranikrishnan-1796 asked jansiranikrishnan-1796 commented

Executing powershell script from Orchestrator

Hi Team,

I have a workflow(Runbook) created in Orchestrator, in which one of the activity is "Execute PS script". I have this script created in ServiceManager(SM) server(IDCSCSM01T). How can we call this script from the orchestrator (Runbook)?

I tried the below option. But it is not working.

  1. I selected the properties of the "Execute PS script" activity

  2. Go to the option "Input Properties", give the path of the script as "//IDCSCSM01T/C:/Jansi/SendRequest.ps1" against the filed name: 'PS Script 01'


Can anyone please correct me if am wrong?

Regards,
Jansi



msc-orchestrator
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered jansiranikrishnan-1796 commented

Hi @jansiranikrishnan-1796 ,

You can use the Subscribe -> Published Data feature in Orchestrator to pass the values/data from one activity to the next.
This way you can pass the ID from the Monitor activity to the Run .Net Script activity in the script.

92722-image.png

92686-image.png

The result should look like this:

92724-image.png

Update Object activity:

92658-image.png


To update the Incident there is another activity in the SCSM Integration Pack called "Update Object".
This way you can update the Incident Record that triggered the Monitor object.
Just make sure the Run .Net Script activity is returning the values from ServiceNow you need for the update.

If you are new to SCSM and Orchestrator I would recommend to buy books for both products. There are a few books available if you try a search engine ;-).
I avoid to do a direct advertisement for books here, sorry.


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten




image.png (92.6 KiB)
image.png (70.4 KiB)
image.png (70.8 KiB)
image.png (57.1 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Andreas,

I tried this option today, But somehow monitor object activity not picking the newly created incident. I will spend some more time on testing and get back to you on this implementation by Monday.

Thanks for your support.

Regards,
Jansi

0 Votes 0 ·
AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered jansiranikrishnan-1796 commented

Hi @jansiranikrishnan-1796 ,

for executing PowerShell commands I am always using the Run .Net Script activity in Orchestrator.

A simple demo is shown here:
http://get-cmd.com/?p=3731

In this blog post you can see how to use the latest PowerShell version in Orchestrator as well.

Here is another blog post how to use PowerShell and the Run .Net Script activity:
https://blog.ctglobalservices.com/powershell/jgs/orchestrator-using-run-net-script-activity-powershell-inputting-and-returning-data/


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi Andreas,

First of all, A big thank you for responding immediately. I have gone through the above links, but it doesn't seems to suit my requirement.

Thanks again for your time and effort.

I tried using "Run .Net Script", but it is not working, May be i have to explore more on this.

Regards,
Jansi

0 Votes 0 ·

Hi @jansiranikrishnan-1796 ,

if you could describe a little more detailed "what us not working" it would be easier to help.

Exploring is nice but if you need some help or if you have questions please don't hesitate to ask.


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten








0 Votes 0 ·

Hi Andreas,

I have a Runbook created in Orchestrator which contains the below 3 activities.

  1. Monitor Object (Which triggers whenever a new incident created or an existing incident gets modified)

  2. Run .Net Script (which retrieves the ticket information and format it to the JSON format and make a web-service call to the Service-Now with the incident information)

  3. Update Object (Process the response from the Service-Now, Update the information into the incident)


I have three questions on the information above.
1. How should i pass the incident ID retrieved from the first activity to the second activity?
2. I have written the script and when i tried to publish or print the variables (Example: Title, Id, Description etc), it is failed.
3. How to pass the response (Which contains the reference-ID) to the third activity, so that i have to write another shell script and then update to the incident.

Please let me know if anymore information is required.

Regards,
Jansi





0 Votes 0 ·