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

Re: How to transfer a file to vm

$
0
0

Inside the vCO client you need to switch to "Design" mode and then select the "resource" button.  It is there that you need to upload your add or file.

 

to copy the file to a VM here is the first scriptable task:

 

var vcoPath = System.getTempDirectory() + "/" + System.nextUUID();

resourceElement.writeContentToFile(vcoPath);

 

var host = vm.sdkConnection;

 

 

var date = Date.now();

var dateStart = new Date(date);

var startDate = System.formatDate(dateStart, "yyyyMMdd");

var fileName = "VMPROFILE"+startDate+".csv";

//var guestFilePath = "D:\\\\temp\\"+fileName

var guestFilePath =  "\\\\server\\folder\\\\"+fileName

var guestOperationsManager = host.guestOperationsManager;

var guestAuth = new VcNamePasswordAuthentication();

guestAuth.username = vmUsername;

guestAuth.password = vmPassword;

 

 

var fileManager = guestOperationsManager.fileManager;

result = false;

var attr = new VcGuestFileAttributes();

var srcFile = new File(vcoPath);

var uri = fileManager.initiateFileTransferToGuest(vm , guestAuth ,guestFilePath, attr, srcFile.length, overwrite);

result = fileManager.putFile(vcoPath, uri);


Viewing all articles
Browse latest Browse all 230663

Trending Articles