VMware {code} Community
d0se
Contributor
Contributor
Jump to solution

Trying to read all IPs of a windows xp guest system on ESX 3.5

Hi,

i've recently set up a ESX 3.5 server for testing purposes since we are going to replace our VMware Server solution with ESX 3.5 on a more powerful server. Now i'm trying to migrate our own C# software which is build up on the VMware Server software to ESX. To control virtual machines i'm using the wrapper project VMWareTasks of dblock so far - thanks for this nice work.

My actual problem is getting all ip addresses of a guest system (win xp prof). With the following code i get only one ip address, seems to be the one the guest system gets at last (in case of dhcp).

vm = virtualHost.Open("path.vmx");

vm.PowerOn(180);

vm.WaitForToolsInGuest(180);

Console.WriteLine(vm.GuestVariables);

Out of Infrastructure-Client i know that there must be a way to get all of them since i see them all under summary. Think i read something about Infrastructure Client also using the VIX API? So i tried other names for the guest variables, like "ips" or kind of indexing like "ip0", "ip1" but this wasn't successful. Also searched for a list of accessible variables of the guest system but this wasn't successful either.

Does anyone have an idea how to solve this? Would be great!

Thanks & regards

Tags (6)
0 Kudos
1 Solution

Accepted Solutions
fixitchris
Hot Shot
Hot Shot
Jump to solution

d0se, VI Client is extensible with VI Toolkit/ VI SDK. Why not use WMI to enumerate all NICs + IPs?

dblock, If you want to go the agent route, why not duplicate NetCat functionality to create a remote command prompt ? I can send you a VB.NET implementation of my remote command shell...

View solution in original post

0 Kudos
2 Replies
dblock
Enthusiast
Enthusiast
Jump to solution

I went down this path before unsuccessfuly. It's not possible to enumerate all the variables (long time feature request), and nobody would publish a list of variables available/known. Maybe people can chip in with the ones they know?

We chose another route. We run ipconfig, dump the output in a file, bring the file back and parse the output.

I'd like to generalize this approach. I've been wanting to embed a small agent with VMWareTasks that can run a command, then collect stdout/stderr, dump that into a structured temporary xml file or something like that and bring it back to the host system. It could be nicely wrapped in the library and would look like an extension of RunProgramInGuest. You could then either run ipconfig or some other tool that dumps the IPs. Feel free to contribute Smiley Happy

cheers

dB.

fixitchris
Hot Shot
Hot Shot
Jump to solution

d0se, VI Client is extensible with VI Toolkit/ VI SDK. Why not use WMI to enumerate all NICs + IPs?

dblock, If you want to go the agent route, why not duplicate NetCat functionality to create a remote command prompt ? I can send you a VB.NET implementation of my remote command shell...

0 Kudos