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.
- 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:
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”
- Save and Close the file.
The VM has be restarted for the changes to take effect.
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.
- A vSphere Web services client program calls a function in the vSphere API.
- The client sends a SOAP command over https (port 443) to vCenter Server.
- The vCenter Server passes the command to the host agent process hostd, which sends it to VMX.
- VMX relays the command to VMware Tools in the guest.
- 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”