question

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

Executing an Orchestrator Runbook via PowerShell

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


windows-server-powershellmsc-orchestrator
image.png (12.8 KiB)
image.png (19.0 KiB)
image.png (35.0 KiB)
image.png (34.2 KiB)
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 ,

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


image.png (469.6 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,

No words to express my gratitude, So you're just so awesome. Your guess was correct. Actually one of the Orchestrator services (Orchestrator Runbook Service) was not running and i started this service and tested the powershell script. It is working as expected.

Thanks a lot for your efforts and investing your time to answer my queries You are really an expert.

Regards,
Jansi

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

Hi @jansiranikrishnan-1796 ,

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

· 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,

Thank you for the inputs.

I have added the above two lines in the Run .Net Script activity of the Runbook (created in Orchestrator Server) and executed the PowerShell script (Service Manager server). No error returned from the PowerShell script.

104714-image.png

Looks like the Runbook is running for non-stop and i had to explicitly stop the job in the Orchestrator Console window.
104676-image.png

Also there is a warning logged for this Runbook as shown below.
104735-image.png

I was not able to get what went wrong and why this is not working as expected. I really struck at this point. Please share any idea or inputs to proceed further.


0 Votes 0 ·
image.png (28.3 KiB)
image.png (75.1 KiB)
image.png (14.2 KiB)
AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered AndreasBaumgarten edited

Hi @jansiranikrishnan-1796 ,

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

· 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,

Yes. Executing the Runbook from the Runbook Designer is working fine.
There is nothing defined in the Runbook properties. I think it is taking the default server name.
104830-image.png


0 Votes 0 ·
image.png (22.3 KiB)

Hi @jansiranikrishnan-1796 ,

as I wrote above: All Orchestrator services are running on every Orchestrator server?


(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,

Please help me in understanding on how to check the orchestrator services are running on every orchestrator server.

Regards,
Jansi

0 Votes 0 ·