Running 64-bit Windows PowerShell from Orchestrator
How to run 64-bit PowerShell commands from System Center Orchestrator on the runbook server.
February 23, 2013
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.
Create a Run .Net Script activity from the System activities group.
Select PowerShell as the language.
In the Script area enclose your PowerShell commands in the following code:
Invoke-Command -ScriptBlock {YOUR CODE} -ComputerName localhost
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
You May Also Like