VMware Cloud Community
mcssschaefer
Enthusiast
Enthusiast

Java and PowerShell

Hi,

I have written a Java class which calls a PowerShell Script. The PowerShell script uses "Invoke-Command" to execute a local script on a remote host.

This works fine. It's also possible to get the output of the PowerShell and display it. Since Iam not able to pass PowerShell Objects (VMware vSphere & View) to Java (And there is no WebService or something for VMware View, isn't it?) I have no other choice  to write all the logic in PowerShell.
But now it's getting tricky. Iam not sure what's the prefered way of passing information from Powershell to Java. I can read "line by line" from stdout. But it's seems very ugly to me. Maybe I could transform the output with Convet-To-XML use temporary files and read it from Java.
Someone have experience how to manage this? Any ideas/hints?
Thanks in advance,
Stephan
http://blog.mightycare.de http://www.mightycare.de
Reply
0 Kudos
1 Reply