Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Struggling to run Powershell scripts / commands

$
0
0

Hi all!

 

I'm struggling to get Powershell workflows working from vCO.  I suspect I've missed something really obvious, but I just can't see it...

 

I've done the Kerberos set up on the command line of my vCO 5.5.2 appliance.  I've added a Powershell v2 host using the VMWare provided workflows from the Powershell 1.0.4 plugin install, doing Kerberos authentication, and using a shared account (mine, as I know I'm an admin on the Windows server).  I've ensured Kerberos authentication and unencrypted traffic is accepted on the Powershell host.  If I validate the object created in vCO, it says it's fine.

 

When I come to run another of the VMWare provided workflows, I'm either getting error responses because the workflows don't seem to be correctly formed, or I'm getting a response of null.  When I run a workflow, I can see my account logging on in the Windows 2008 server's security log, so I am fairly confident that the basic connection and Kerberos portions are all ok.

 

I've just tried to simplify one of the VMWare provided workflows, to make it as basic as possible (code below).  I still get a response of Null.  Does anyone have any ideas why?  Or is anyone able to provide the code for a very simple Powershell based workflow that they know works so I can test on my set up?

 

Simple powershell script based on the VMWare provided one to get some directory contents, and the values I've been using - this returns Null:

 

input of host, type:PowerShell:PowerShellHost, value:<myPowershellHostSelectedFromPluginManually>

input of directory, type:String, value: I'm manually entering $home.  Or C:.  Or C:\Windows.  Or any other directory I know exists that my user account has no issues seeing.

output of Result, type:string, value:<whatever the ("DIR " + directory) outputs>

 

var sess;

// connect to host

  sess = host.openSession()

 

// send command to powershell

  sess.addCommandFromString("dir " + directory)

 

// invoke command

  invResult = sess.invokePipeline();

 

// get result

  Result = invResult.getResults()

 

// Send out to log

  System.log("Result is " + Result)

 

 

Thanks a lot in advance!


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>