Running 64-bit Windows PowerShell from Orchestrator

How to run 64-bit PowerShell commands from System Center Orchestrator on the runbook server.

John Savill

February 23, 2013

1 Min Read
Running 64-bit Windows PowerShell from Orchestrator

Q: How can I run 64-bit PowerShell commands from System Center Orchestrator on the runbook server?

A: Because System Center Orchestrator is actually 32-bit code (even SP1) it isn't possible to run 64-bit Windows PowerShell from a normal command execution. However, it's still possible with a little piece of script.

  1. Create a Run .Net Script activity from the System activities group.

  2. Select PowerShell as the language.

  3. In the Script area enclose your PowerShell commands in the following code:

    Invoke-Command -ScriptBlock {YOUR CODE} -ComputerName localhost


     

  4. Click Finish

The only requirement is that WinRM must be enabled on the runbook server, which can be accomplished very easily by running the "winrm quickconfig" command. It's enabled by default on Windows Server 2012.

A more powerful option that allows the passing of credentials is shown below:

$Username = "domainusername"$Password = "Password"$ServerName = "hostname"$ErrorActionPreference = "Stop"try{    $securePassword = ConvertTo-SecureString $Password -AsPlainText -Force    $credential = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $Username,$securePassword    Invoke-Command -ComputerName $ServerName -credential $credential -ScriptBlock {YOUR CODE}}catch{Throw $_.Exception}

 

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like