Orchestrator Run Program PowerShell Stuck on Running

Brian 21 Reputation points
2020-11-09T16:52:50.867+00:00

Hello,

I have a runbook that is associated with a new hire form from Service Manager. The runbook does a few things like getting and updating the original SR. The next step is a "Run .Net Script" with language type set to PowerShell. The only thing this does is create a string with all the important variables and returns it.

$String = 'Var1,Var2,Var3,Var4'

I then trigger a "Run Program" that calls the PowerShell script and passes in the parameter string from above. The code looks like this.

powershell.exe -c "D:\Scripts\MyScript.ps1 -MyParamString ""$String"""

Right now, the contents of the script are extremely simple. It basically takes that string, breaks it up and then writes the information to a log. I currently have two modules that it imports, a custom one and AD. The custom one is a logging module that I use regularly in other runbooks without issue.

The issue is that when I trigger the runbook, it would seem as though the script is running as it creates the log and does everything that I expect it to do. However, Orchestrator still shows the "Run Program" as running and doesn't seem to end (let it go for over 10 minutes before). I have tried a few different things but have been unable to figure out why it continues to be "running." I have tried replacing the PowerShell.exe with the full path (C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe) and messing with the quotes. If I run the script from powershell, it runs without issue.

Any ideas would be appreciated. Thank you.

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.
215 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Laude 85,666 Reputation points
    2020-11-09T18:51:35.177+00:00

    Hi @Brian ,

    Does your Orchestrator service account have has local administrative rights on the local and remote computer?

    As for the Run Program runbook activity, you could try adding the following to the end of the command: <NUL 2>&1

    Example:

    38375-runprogram-example.png

    ----------

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

    Best regards,
    Leon


1 additional answer

Sort by: Most helpful
  1. Brian 21 Reputation points
    2020-11-09T18:41:28.613+00:00

    Logged in as the service account and ran the runbook tester. When it gets to Run Program, it errors and says "Could not start Ochestrator Run Program service on SERVER - Access is denied. (code 5).

    The service is set for Local System and the account that runs the runbook service is a local administrator.

    0 comments No comments