VMware {code} Community
msaeed
Contributor
Contributor

IO Redirection

I am mainly using the Vix API through vmrun scripting interface.

Is there a way to redirect guest std(in|out|err) from/to the host OS? I would like to capture the output of the programs I run in the guest.

Idealy, I would just ssh to the guest, but it's a bit cumbersome

to find the ip address of a headless guest OS.

Thanks!

0 Kudos
1 Reply
admin
Immortal
Immortal

There isn't a way to do this directly, but you can use the basic redirection mechanisms in the guest shell to redirect IO to a file, and combine that with copyFileFromHostToGuest/copyFileFromGuestToHost.

So, something like:

vmrun -gu user -gp password runProgramInGuest ./vm.vmx "/bin/sh" "/sbin/ifconfig > /tmp/ifconf.txt"
vmrun -gu user -gp password copyFileFromGuestToHost ./vm.vmx /tmp/ifconf.txt /host/path/ifconfig.txt
vmrun -gu user -gp password deleteFileInGuest ./vm.vmx /tmp/ifconf.txt

0 Kudos