26 May 2013

How to execute 64-Bit Powershell Scripts in System Center Orchestrator

I came along a weird issue when trying to automate a SCVMM Hyper-V Bare metal Deployment using System Center Orchestrator 2012 SP1. As the System Center Integration Pack for SCVMM is focused on virtual machine automation tasks, I had to create my own Powershell scripts.

The Difficulty

System Center Orchestrator is built in x86 architecture (yes.. still the 2012 SP1 version I’m using on a Server 2012). Therefore the built-in Script execution action executes the PoSh code in x86 Powershell environment. This is not very useful for x64 based management modules or snapIns like SCVMM, Exchange 2010/2013 or SCCM. Trying to execute a SCVMM CMDLET like in the example here:

..ends with an Error (CMDLET is unknown)

This happens because SCVMM PoSh modules are not available in x86 Powershell environments.

The Workarounds

There are basically three different workarounds I’m currently aware of. If you know other or better ones please let me know.

  1. **Use Run Program Action
    **

  1. Run the code inside a x64-Bit Powershell environment

 

  1. Use ExecutePS Integration Pack 1.1 from Charlesjoy on CodePlex
    http://orchestrator.codeplex.com/releases/view/76101

 

Which one would I choose?

Well for simple tasks I’d choose option 2 because it doesn’t require additional IP installation and knowledge. For more sophisticated tasks I’ll take the ExecutePS IP which is the Ferrari IMHO to execute Powershell code inside System Center Orchestrator.