Options to copy files from VM Guest to Client PC or vice versa

Not many of us use the clipboard option available in vSphere client to copy and paste files across VMs.

I just wanted to share couple of options that can be used other than normal RDP or SMB.

  1. Enable clipboard copy in vSphere Client
  • Log in to a vCenter Server system using the vSphere Client and power off the virtual machine.
  • Select the virtual machine and click the Summary tab.
  • Click Edit Settings.
  • Navigate to Options > Advanced > General and click Configuration Parameters.
  • Click Add Row.
  • Type these values in the Name and Value columns:

 

isolation.tools.copy.disable        FALSE
isolation.tools.paste.disable       FALSE

To enable the same across all VMs on a hosts.

  • Log in to the ESX/ESXi host as a root user.
  • Take a backup of the /etc/vmware/config file.
  • Open the /etc/vmware/config file using a text editor.
  • Add these entries to the file:

                vmx.fullpath = “/bin/vmx”
isolation.tools.copy.disable=”FALSE”
isolation.tools.paste.disable=”FALSE”

  • Save and Close the file.

The VM has be restarted for the changes to take effect.

2) Copy-VMGuestFile

This can used with powercli (32 bit) and it’s very helpful if you want to move some file from across VMs.

Especially for the ones which are in DMZ and Clipboard or RDP is disabled for security reasons.

Copy-VMGuestFile -Source c:\test.txt -Destination c:\temp\ -VM myVM -GuestToLocal -HostUser root -HostPassword pass1 -GuestUser user -GuestPassword pass2

Make sure you are connected to vCenter using the FQDN.

The Copy-VMGuestFile uses the vSphere API ad uses the below procedure.

CopyVMGuestFIle2

  1. A vSphere Web services client program calls a function in the vSphere API.
  2. The client sends a SOAP command over https (port 443) to vCenter Server.
  3. The vCenter Server passes the command to the host agent process hostd, which sends it to VMX.
  4. VMX relays the command to VMware Tools in the guest.
  5. VMware Tools has the Guest OS execute the guest operation.

The same cmdlet can be used to copy files from clients to VM.

Copy-VMGuestFile -VM myVM -LocalToGuest -Source “C:\temp\test.txt” -Destination “c:\test” -GuestUser “Guestaccoutdetails” -GuestPassword “passowrd”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s