Change PowerShell Version used by Orchestrator

System Center Orchestrator 2012 R2 limits the version of PowerShell available to runbooks to PowerShell Version 2.0. To leverage the capabilities of current PowerShell versions you can make the following registry change on each of the Orchestrator Runbook servers.

Change PowerShell Version used by Orchestrator

Force Orchestrator to utilize the highest installed version of PowerShell by setting the registry value below. This may impact the ability for other applications, or scripts which depend on lower .NET / PowerShell versions to execute properly.



HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework
DWord-Value OnlyUseLatestCLR = 1

Validation:

Create a Runbook with a "Run .Net Script" activity.
Configure the activity with the following details:
    Language:    PowerShell
    SCRIPT1:    $CLRversion = (get-host).version
$PSversion = $PSVersionTable.PSVersion

Another option:

If you're have a limited need to execute PowerShell in Orchestrator Runbooks, or are not able to use the procedure above, then try this. In the Run .NET Script activity, run your PowerShell code inside of a script block

$return = PowerShell { ###Add script here### }

Running PowerShell code inside a scriptblock is the same process used when executing PowerShell code in an SMA PowerShell Workflow based runbook.