VMware Cloud Community
SiteRecoveryMan
Enthusiast
Enthusiast

How to transfer a file to vm

Hi ..

how can we transfer a file "doc or App .exe file" to a VM created by vRA 7.2 ?!

the newly created VMs out of Blueprints has the Operating system or any pre shipped app but

how can the end user add another app of his own from his desktop for instance or transfer a word doc from his own desktop to the vm in the vRA cloud ?!!

Thank you very much

0 Kudos
3 Replies
sbeaver
Leadership
Leadership

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);

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
SiteRecoveryMan
Enthusiast
Enthusiast

Thanks sbeaver for the reply,..

what I meant, is from the end user point of view, in other words,

the end user who opened the catalog & chose the blueprint, will end up with a VM,

the question is, how the end user can transfer a file whether a doc or an .exe file to that vm from his own desktop ?

when the end user connect to the vm using VMRC the option (Removable media) is grayed out for the vms created by VRA 7 as shown in the attached picture..

is that normal or it's just happening to me ?! because when I try to connect to the same vm using VMRC but from vCenter, I have" Removable media" option available & can be used

to connect iso files to the VM. why it's not working when vmrc is activated from vRA 7 user portal ?!

I appreciate to have an answer for this question & to provide the end users with a simple way to transfer their files & apps to the vms they created in the cloud.

Thanks & Best Regards

0 Kudos
sbeaver
Leadership
Leadership

how the end user can transfer a file whether a doc or an .exe file to that vm from his own desktop ?  This is where XaaS comes into play.  You can create a XaaS catalog item that just gets and moves files around or better yet use XaaS to create and action that can be clicked and away you go.  What you are asking for is what I would consider 2nd day operations and if you can script it, you can present as a catalog item

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos