Vmrun return all IPs for running VMs

From VI-Toolkit
Jump to: navigation, search

Return all IPs for running VMs

If you want to do this through vmrun on VMware Server 2, then you can do the following:

vmrun -T server -h https://myserver/sdk -u root -p passwd -gu root -gp passwd runProgramInGuest "[standard] test/SLES10sp1.vmx" /bin/sh "/sbin/ifconfig > /tmp/ip-info.txt"
vmrun -T server -h https://myserver/sdk -u root -p passwd -gu root -gp passwd copyFileFromGuestToHost "[standard] test/SLES10sp1.vmx" /tmp/ip-info.txt /host/path/ip-info.txt"
vmrun -T server -h https://myserver/sdk -u root -p passwd -gu root -gp passwd deleteFileInGuest "[standard] test/SLES10sp1.vmx" /tmp/ip-info.txt

This will redirect the output of ifconfig to a file on the guest, then copy that file to the host. It also cleans up the file, just to be tidy.


See also:

http://communities.vmware.com/message/1087204#1087204