Quantcast
Channel: VMware Communities : Discussion List - VMware {code}
Viewing all articles
Browse latest Browse all 2738

CopyfilefromHosttoGuest is not working: Throwing Exception

$
0
0

Hi,

 

I wrote a script to Automate file copy from my base machine(win7) to vmware workstation hosting windows 7 guest. I loaded Vestris.VMWareLib.dll(Version 1.6) in into Powershell and able to perform power on, Create directory and create snapshot but couldn't copy file from host to guest. Is there anything missing to perform file copy?

 

VIX downloaded from - VMWareTasks 1.6 - VMWareTasks: C# VixCOM wrapper library & tools (MOVED TO GITHUB) - Home

Vmware workstation: 7.0.0

Powershell: 3.0

Host: Windows 7 32 bit

Guest: Windows 7 32 bit(Running on vmware workstation 7.0.0 build-203739)

 

Script:

 

Add-Type -Path "D:\Vmware\vm\Interop.VixCOM.dll"

add-type -path "D:\Vmware\vm\Vestris.VMWareLib.dll"

$newvm =  New-Object "Vestris.VMWareComLib.VMWareVirtualHost"

$newvm.ConnectToVMWareWorkstation()

$power = $newvm.Open("D:\windows7 image\Windows 7.vmx")

$power.PowerOn()

$power.logininguest("test123","123456")

$folder = "tr1254as7"

$power.RunProgramInGuest("cmd.exe","/c md $folder")

$power.copyfilefromhosttoguest2("D:\testcopy\test.log","C:\$folder\test.log",1200)

 

Exception:

Exception calling "CopyFileFromHostToGuest2" with "3" argument(s): "Failed to

copy file from guest to host: guestPathName="D:\testcopy\test.log"

hostPathName="C:\tr1254as7\test.log" timeoutInSeconds=1200"

At line:7 char:1

+ $power.copyfilefromhosttoguest2("D:\testcopy\test.log","C:\$folder\test

.lo ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : Exception

 

I tried Copyfilefromhosttoguest() and Copyfilefromhosttoguest2() none of them is working.

Could any help me out, i am almost completed automation apart from copy file. It would be really helpful is someone answer.

 

Thanks,

Pavan


Viewing all articles
Browse latest Browse all 2738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>