VMware {code} Community
hnehlsen
Enthusiast
Enthusiast
Jump to solution

Getting hostname of ESX-Server...

Hi,

I'm a bit at loss. Here is what I want to do. Getting some information about the vms in my VC plus the hostname of the esx-server the vm resides on. Sounds pretty easy but I don't seem to get that working.

May be someone could point me in the right direction.

thanx

Harro

0 Kudos
1 Solution

Accepted Solutions
hrobinson
VMware Employee
VMware Employee
Jump to solution

If you download the beta-2 version of the toolkit, you will find vminfo.pl in the apps/vm directory.

The utility vminfo.pl can be used for that.

vminfo.pl --fields name,hostName

gives you everything you want. You may want to refine the output for your needs but it gives you the basic things in a pretty compact script.

View solution in original post

0 Kudos
4 Replies
hrobinson
VMware Employee
VMware Employee
Jump to solution

You didn't mention the language. But here's the basic operation.

The virtual machine object

VirtualMachine.runtime.host => moRef of the host object

get the host object

host.name = name of host.

0 Kudos
hnehlsen
Enthusiast
Enthusiast
Jump to solution

Hi,

sorry the language is perl.

Harro

0 Kudos
hrobinson
VMware Employee
VMware Employee
Jump to solution

If you download the beta-2 version of the toolkit, you will find vminfo.pl in the apps/vm directory.

The utility vminfo.pl can be used for that.

vminfo.pl --fields name,hostName

gives you everything you want. You may want to refine the output for your needs but it gives you the basic things in a pretty compact script.

0 Kudos
hnehlsen
Enthusiast
Enthusiast
Jump to solution

thanx, that did the job!

Harro, Smiley Happy

0 Kudos