Skip navigation
Call Windows PowerShell from Orchestrator

Call Windows PowerShell from Orchestrator

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.

  1. One easy option is to place the PowerShell within Powershell.exe { <your code> } which runs the code in a V3-but-still-32-bit PowerShell environment.
  2. To run in a V3, 64-bit PowerShell environment, use C:\Windows\sysnative\WindowsPowerShell\v1.0\powershell.exe { <your code> }.
  3. The last option is to use Invoke-Command -ComputerName localhost -ScriptBlock { <your code> }. 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.
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish