Orchestrator executes by default, it’s command in PowerShell 2.0 instead of using the latest PowerShell version installed on your system. It means that if you use the Run .Net Script Activity, Orchestrator will run your PowerShell commands in version 2.0 even if you have PowerShell v4 or v5 installed.
If you want to check which version your Orchestrator Server will use, you can create an easy runbook with a Net. activity:
Edit the task and type the following command:
$PSVer = $PSVersionTable.PsVersion
And go to “Published Data” and create the PSVer variable:
Now edit your runbook and select the following options:
Run the runbook and check result in “log history” tab:
OK, how to force Orchestrator to use the PowerShell version installed on the server?
That’s pretty simple, you must set the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\OnlyUseLatestCLR
- Type : REG_DWORD
- Value name : OnlyUseLatestCLR
- Value Data : 1
Reboot your Orchestrator Server and run again your runbook:
Thanks for reading! You can follow me on Twitter @PrigentNico