Executing powershell script from Orchestrator

jansi rani krishnan 601 Reputation points
2021-04-27T16:27:11.847+00:00

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

System Center Orchestrator
System Center Orchestrator
A family of System Center products that provide an automation platform for orchestrating and integrating both Microsoft and non-Microsoft IT tools.
214 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 96,266 Reputation points MVP
    2021-04-29T19:44:34.95+00:00

    Hi @jansi rani krishnan ,

    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


1 additional answer

Sort by: Most helpful
  1. Andreas Baumgarten 96,266 Reputation points MVP
    2021-04-27T17:27:07.067+00:00

    Hi @jansi rani krishnan ,

    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