Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 233224

Re: vCenter and vCloud Director package integration?

$
0
0

I found I could get the status of the virtual machines inside the vapp but when I try to run a process on the guest vm I get an error that vm.sdkconnection is undefined. the vapp is defined inside the vcloud director.

 

the following code results in:

 

[2013-07-23 14:50:13.809] [I] Name:win2k8r2

[2013-07-23 14:50:13.813] [I] Status:4

[2013-07-23 14:50:13.828] [I] Href:https://<<snipped>>/api/vApp/vm-a09f3eb2-7d38-4896-8fce-c1181f83902c

[2013-07-23 14:50:13.853] [I] StatusDesc:The object is powered on.

[2013-07-23 14:50:13.857] [I] TypeError: Cannot read property "guestOperationsManager" from undefined (<<snipped>>)

 

 

for each (var vm in ArrayOfVms) {

Server.log("Name:"+vm.name);

System.log("Name:"+vm.name);

Server.log("Status:"+vm.status);

System.log("Status:"+vm.status);

Server.log("Href:"+vm.href);

System.log("Href:"+vm.href);

Server.log("StatusDesc:"+vm.vmStatusDescription);

System.log("StatusDesc:"+vm.vmStatusDescription);

 

 

 

 

var host = vm.sdkConnection;

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = snipped

guestAuth.password = snipped

guestAuth.interactiveSession = true;

 

var guestProgramSpec = new VcGuestProgramSpec();

guestProgramSpec.programPath = "C:\Users\Administrator\Downloads\<<snipped>>.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);

}


Viewing all articles
Browse latest Browse all 233224

Trending Articles