VMware {code} Community
samsvmware
Enthusiast
Enthusiast

Hardware Infos of VM ?

Hi Friends,

I need a perl api script to get these information ('Video card','SCSI controller','CD/DVD drive','Network adapter','VMCI device')  of a Virtual Machine? Can any one help me ?

2 Replies
pranesh_rao82
Contributor
Contributor

Hi Sams,

Get the vm_view; use Dumper and parse through the xml output. I usually do that way. You get all information. Usually VMware has all the necessary functions/APIs to get all VM info. If you don't know the required API, this method comes in handy.

Example:

     my $vm_view = Vim::find_entity_views(view_type => 'VirtualMachine', filter => {name => '76-VM0'});

     foreach(@$vm_view) {

             my $vm_name = $_->summary->config->name;

             my $devices =$_->config->hardware->device;

             my $uuid =$_->config->instanceUuid;

             if($_->config->template) {

                     print "Yes, It is a template..!!!!!\n";

             }

             else {

                print "No, It is not a template..!!!!!\n"

             }

             print "===UUID==$uuid===\n";

             my $guest_net_info = $_->guest->net;

             print "Dumper==" . Dumper($_);

     }

Regards,

Pranesh

samsvmware
Enthusiast
Enthusiast

Thanks Pranesh .. do you know how to get the blade/chassis information of vm or host or datacenter?? i need that also .. some one suggest me to get it from 'baseband management controller' how to get it ?