VMware {code} Community
Nasu
Contributor
Contributor

Different Behavior of Script Run on Guest Using VIX API

I am using

Set job = vm.RunProgramInGuest("c:\Windows\System32\wscript.exe", "C:\Copy.vbs", 0, Nothing, Nothing)

to run a simple script on the guest OS. The script is supposed to copy the latest installer for one of the products we develop from another machine. When I run this script on the guest everything works fine but when I run it using the VIX API call above, the script fails, saying the path is not found (800A004C). The problem appears on the last line of the code below. The script in both cases run using wscript.exe and under the same user account.

Dim fileSystem, file, files

Set fileSystem = CreateObject("Scripting.FileSystemObject")

Set fromFolder = fileSystem.GetFolder("
10.158.10.134\packages\dev-cm-python\asinstaller")

Any ideas what may be the problem?

0 Kudos
3 Replies
lemke
VMware Employee
VMware Employee

LoginInGuest() sets user identity to the desired user, but it won't do all the actions of a login, so I suspect the network mount isn't available in the Vix situation.

0 Kudos
Nasu
Contributor
Contributor

So, the only way to copy files to the guest is through VIX API?

0 Kudos
admin
Immortal
Immortal

What happens if you do:

Set job = vm.FileExistsInGuest(\\10.158.10.134\packages\dev-cm-python\asinstaller", Nothing, Nothing)
err = job.Wait(Array(VixCOM.Constants.VIX_PROPERTY_JOB_RESULT_GUEST_OBJECT_EXISTS), results)

If results(0) Then
   WScript.Echo("File exists")
Else
   WScript.Echo("File does not exist") 
End If

0 Kudos