Executing an Orchestrator Runbook via PowerShell

jansi rani krishnan 601 Reputation points
2021-06-10T18:04:38.74+00:00

Hi Team,

I created a Runbook which actually receives the input and updates the data into the incident form. It contains two activities.

  1. Initialize data
  2. Run .Net Script

PFA the screenshot for the same.

104391-image.png
104310-image.png

I have written a PowerShell code to execute this Runbook via web-service call. PFA the snapshot of the code as follows.

104343-image.png
104318-image.png

When i executed the PowerShell script, the Runbook is not functioning as expected. There is no error returned from the script. The Runbook job status is running continuously and i had to manually stop the job after a while in the Orchestrator Console window. What could be the issue?

I also tested the Runbook independently and it is working fine as expected. Am i missing anything here.

Any inputs is highly appreciated.

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.
217 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,407 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 98,626 Reputation points MVP
    2021-06-12T19:05:15.377+00:00

    Hi @jansi rani krishnan ,

    these are the Orchestrator services:

    105047-image.png

    ----------

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

    Regards
    Andreas Baumgarten


2 additional answers

Sort by: Most helpful
  1. Andreas Baumgarten 98,626 Reputation points MVP
    2021-06-10T19:38:07.33+00:00

    Hi @jansi rani krishnan ,

    I am missing the Import-Module SMLets line in your Run .Net Script activity.
    Also missing is the smdefaultserver = <yourSCSMserver> line.

    Both lines are required to run the script with SCSM cmdlets on the Orchestrator Server.
    For that reason I am wondering the Runbook is working if started in the Runbook Tester.

    If the Runbook is triggered by the invoke PowerShell script in which activity it is "hanging"?

    ----------

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

    Regards
    Andreas Baumgarten


  2. Andreas Baumgarten 98,626 Reputation points MVP
    2021-06-11T10:54:33.853+00:00

    Hi @jansi rani krishnan ,

    if you start the Runbook via Runbook Designer it's working?

    Which Runbook Servers are defined in the Runbook properties/settings?
    Please verify the Orchestrator services are running on all Orchestrator Servers.

    ----------

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

    Regards
    Andreas Baumgarten