VMware {code} Community
Melgaard
Enthusiast
Enthusiast

CopyFileFromHostToGuest - INTERNAL ERROR: A file was not found

Hey, I am trying to Copy files into a VMWare image hosted in ESX using VIX (C# Wrapper around the COM API), but I can't quite get it right.

Conceptual Something like:

IVMWareVirtualHost host = new VMWareVirtualHost();

host.ConnectToVMWareVIServer("172.18.19.69", "ESX Admin User", "ESX Admin Password");

IVMWareVirtualMachine virtualMachine = host.Open("[Storage1] Image/Image.vmx");

virtualMachine.PowerOn();

virtualMachine.WaitForToolsInGuest();

virtualMachine.LoginInGuest("Administrator", "ILoveOMSIS!1234");

virtualMachine.CopyFileFromHostToGuest("C:
temp
File.txt", "C:
package
File.txt");

And it fails at the last line with "INTERNAL ERROR: A file was not found"...

The File exists Locally, Casing is corrent and the "C:\package" folder exists in the Guest.

Host System: ESX 4.0

Guest System: Windows XP

Client System: Windows 2003 server

(Client System refers to the system where I try tu run the commands and vmrun.exe

After trying to find some help ect on the web, I went to "vmrun" and tested a command that used to work with the "VMWare Server"

vmrun -T server -h https://localhost:8333/sdk -u "Local Admin User" -p "Local Admin Password" -gu "Guest Admin account" -gp "Guest Admin password" CopyFileFromHostToGuest "[Standard] Image/Image.vmx" "C:\temp\file.txt" "C:\package\file.txt"

changed to:

vmrun -T server -h https://172.18.19.69/sdk -u "ESX Admin User" -p "ESX Admin Password" -gu "Guest Admin account" -gp "Guest Admin password" CopyFileFromHostToGuest "[Storage1] Image/Image.vmx" "C:\temp\file.txt" "C:\package\file.txt"

Both Works just fine...

So what am I'm doing wrong in the code?

0 Kudos
4 Replies
stanguturi
VMware Employee
VMware Employee

Are you able to successfully execute LoginInGuest() function. "File Not Found" can be returned if proper VMX file path is not provided in proper format.

If possible, can you please follow these steps mentioned at

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=101956...

and attach the log files. Hopefully, issue can be found out using the log files.

-Thanks

Sankar.

0 Kudos
Melgaard
Enthusiast
Enthusiast

Hello...

Well it seems that it isn't an Error in the API supplied by VMWare but rather the wrapper, I have manged to successfully do the wrapping my self and transfer files...

0 Kudos
dblock
Enthusiast
Enthusiast

I assume you're talking about VMWareTasks. Can you please elaborate the differences/suggest a fix? Thx.

0 Kudos
icnocop2
Contributor
Contributor

I think the problem here is that you need to explicitly create the directory in the guest before copying files into it.

0 Kudos