Call PowerShell scripts from System Center Orchestrator

System Center Orchestrator provides Run .Net Script activity, which can be used to call PowerShell scripts, but there are limitations you should know.

System Center Orchestrator is modular in design, but for uninitiated administrators, it may present some limitations....

Luckily, there are a couple easy workarounds.

You can customize a Runbook created in System Center Orchestrator to execute any program or command-line tasks on the destination system. The Runbook can be executed either in interactive or background mode.

All of the commands and applications you want to execute via Runbook need to be configured in Runbook Activity. To call PowerShell scripts with Runbook, use Run .Net Script activity in System Center Orchestrator, as shown in Figure A below:

PowerShell Run .Net Script window
Figure A. Configure scripts in the Run .Net Script window.

You'll be required to select a scripting language by clicking the Browse button. Then, copy and paste the script code in the Script box and click Finish to call PowerShell. You can configure other options, like adding a namespace for each .NET library you've configured in your code, references for each .NET library, and the published data configurations you usually use for other activities.

One limitation is that System Center Orchestrator doesn't allow configuring credentials associated with the executed PowerShell script. Instead, it will use the service account that's configured on the Runbook server. Similarly, Run .Net Script activity can only execute PowerShell scripts in 32-bit mode.

But that's easily addressed. If you need to call PowerShell scripts in 64-bit mode, you'll be required to use other techniques, such as the Invoke-Command method, which executes the PowerShell code directly on the Runbook server. For example, Invoke-Command --ComputerName Localhost --ScriptBlock {your code here} ensures that the PowerShell code runs in 64-bit mode.

Dig Deeper on Microsoft Hyper-V management