Based upon this I added three parameters to my script: vcenter of type VC:SdkConnection (set to my vcenter) , newvm of type VC:VirtualMachine (unset) and vcloudvm of type vCloud:VM (unset) and modified it as such but I am getting the following error:
[2013-07-24 07:22:59.858] [I] Vim Object Reference Not Found (Dynamic Script Module name : getVCenterVm#2)
for each (var vcloudvm in ArrayOfVms) {
Server.log("Name:"+vcloudvm.name);
System.log("Name:"+vcloudvm.name);
Server.log("Status:"+vcloudvm.status);
System.log("Status:"+vcloudvm.status);
Server.log("Href:"+vcloudvm.href);
System.log("Href:"+vcloudvm.href);
Server.log("StatusDesc:"+vcloudvm.vmStatusDescription);
System.log("StatusDesc:"+vcloudvm.vmStatusDescription);
newvm = System.getModule("com.vmware.pso.library.vcd").getVCenterVm(vcloudvm,vcenter) ;
var host = actionResult.sdkConnection;
var guestOperationsManager = host.guestOperationsManager;
var guestAuth = new VcNamePasswordAuthentication();
snipped
guestAuth.interactiveSession = true;
var guestProgramSpec = new VcGuestProgramSpec();
guestProgramSpec.programPath = "C:\Users\Administrator\Downloads\.bat";
guestProgramSpec.arguments = arguments;
guestProgramSpec.workingDirectory = "C:\Users\Administrator\Downloads";
guestProgramSpec.envVariables = environment;
var processManager = guestOperationsManager.processManager;
result = processManager.startProgramInGuest(vm , guestAuth , guestProgramSpec);
System.log("Ran workflow on" + vm.name);
}
schema: