PowerShell v3 in Orchestrator 2016

PowerShell v3 in Orchestrator 2016

Well this is amazingly annoying, I wrote a script to run in SCORCH 2016 and it kept failing in SCORCH but not when I ran it directly on the system. In SCORCH (Run .Net Script, Set to PowerShell) it didn't understand the Get-AdGroupMember command. It turns out this is known behavior and it's due to SCORCH using PowerShell v2 by default, and ignores the latest version running on your server. When going directly through the PowerShell shortcut you are using the latest version of PowerShell.

You can work around this without much difficulty, these are the easiest code options, you could also do it through a batch file calling your .PS1 script, though that seems cumbersome. You have a couple of options, they all work, or at least worked for me.

1. Powershell v3, 32 bit add this to your code: Powershell.exe { <your code> }

2. Powershell v3, 64bit add this to your code: C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe { <your code> }

3. You could also use Invoke-Command, but I would only use it if you need to connect to a remote computer, but the code is: Invoke-Command -ComputerName <localhost or remote computer name> -ScriptBlock { <your code> }

To view or add a comment, sign in

More articles by James Sargent

Explore content categories