Call Windows PowerShell from Orchestrator
Call Windows PowerShell in different ways from System Center Orchestrator.
October 7, 2013
Q: Why are there different ways to call Windows PowerShell from System Center Orchestrator, and why do I need multiple methods?
A: System Center Orchestrator has a built-in activity, Run .Net Script, that's part of the System activities group. It enables the language to be set to PowerShell, allowing PowerShell scripts to be run. However, there's a problem: System Center Orchestrator (even System Center 2012 R2) is a 32-bit application, which means the native PowerShell execution runs in a V2.0, 32-bit PowerShell session. Therefore, it's common to need to trigger PowerShell using other methods.
One easy option is to place the PowerShell within Powershell.exe { } which runs the code in a V3-but-still-32-bit PowerShell environment.
To run in a V3, 64-bit PowerShell environment, use C:WindowssysnativeWindowsPowerShellv1.0powershell.exe { }.
The last option is to use Invoke-Command -ComputerName localhost -ScriptBlock { }. This will also launch in a V3, 64-bit PowerShell environment, but it has the added benefit that the execution could also be done on a remote machine by changing localhost to a remote server.
About the Author
You May Also Like