VMware Cloud Community
SubuVM
Contributor
Contributor

Copy folder to the guest vm

I am looking to create a workflow which will copy all the setup files required for the installation of that application to the guest vm

execute the setup script to install the application

and finally delete the setup folder.

To get this workflow created, I am looking for a way to copy the setup folder to the guest vm

I know we can copy individual file but is there a way to copy all files in a folder?

0 Kudos
6 Replies
AdrianTT
Enthusiast
Enthusiast

Hi,

If using PowerCLI to you can use the "Copy-VMGuestFIle" cmdlet to copy entire folders also; e.g.

     Copy-VMGuestFile -Source c:\Temp\Folder -Destination c:\temp\FolderOnGuest -VM VM -LocalToGuest -GuestUser user -GuestPassword pass2

This cmdlet copies files and folders from and to the guest OS of the specified virtual machines using VMware Tools. If a file with the same name exists in the destination directory, it is overwritten. Use the GuestUser and GuestPassword, or GuestCredential parameters to authenticate when connecting to the VMware Tools. To authenticate with the host, use the HostUser and HostPassword, or HostCredential parameters. SSPI is not supported. For a list of supported operating systems, see the PowerCLI User's Guide.

You can then use the Invoke-VMScript cmdlet to invoke the execution of a script and return the result.

Kind regards,

Adrian

Please consider marking this answer "correct" or "helpful" if you think your query have been answered correctly. Cheers,
0 Kudos
KRAEMS
Enthusiast
Enthusiast

Hi,

I know neither of these is exactly what you are looking for, but, I've handled this in a pair of different ways:

1)  Zip all the files you want in a zip file, put the zip file on the vRO appliance, then copy and extract the zip on your guest OS.

2)  Create an ISO file from your file set and place the ISO in a vCenter datastore, mount the ISO in your guest OS, and access the files from the CD ROM drive.

0 Kudos
SubuVM
Contributor
Contributor

Thanks Adrian and Kraems,

For Invoke-VMscript to work, I believe we should open the communication between the servers, is that rite?

All my guest servers are are different network and I might find difficult to have the communication between them.

I will give a try about zipping the file and unzip them in the guest

0 Kudos
AdrianTT
Enthusiast
Enthusiast

Hi SubuVM,

The Invoke-VMscript requires VMWare Tools is installed on the Guest - it does not require connectivity between the management plane (where you are executing) and the VM. The script is executed using by a call to the GuestOperationsManager API which will issue the command through the VMWare Tools process running on the Guest VM. The below digram shows the flow; the "VIX client host" is your server executing the cmdlet.

pastedImage_0.png

Hope this helps,

Adrian

Please consider marking this answer "correct" or "helpful" if you think your query have been answered correctly. Cheers,
0 Kudos
SubuVM
Contributor
Contributor

I didnt know this.. It makes it more simpler.

I did a test and invoke-vmscript works fine.. Thanks a lot Adrian

0 Kudos
SubuVM
Contributor
Contributor

Now I need to find a way to run powercli command from orchesterator.

0 Kudos