I am having an issue with a script I have written using the VIPerlToolKit. When I list the VM's in my inventory using the code below I am getting all VM's and Templates returned as well. Is there a filter or a different way to query to gain a list of only actual Virtual Machines and not the templates on the system.
my $vm = Vim::find_entity_views(view_type => "VirtualMachine");
foreach (@$vm) {
eval {
my $vmname = $_->name;
# Do Some Work Here
}
}
Thanks Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sure, you can filter VM (same for every entity type) when you retrieve it.
Here is what you can make to list templates, just switch the "1" to "0" to get all machines.
Hello All!
I am having an issue with a script I have written using the VIPerlToolKit. When I list the VM's in my inventory using the code below I am getting all VM's and Templates returned as well. Is there a filter or a different way to query to gain a list of only actual Virtual Machines and not the templates on the system.
my $vm = Vim::find_entity_views(view_type => "VirtualMachine");
foreach (@$vm) {
eval {
my $vmname = $_->name;
# Do Some Work Here
}
}
Thanks Chris
Sure, you can filter VM (same for every entity type) when you retrieve it.
Here is what you can make to list templates, just switch the "1" to "0" to get all machines.
Note : this forum is almost dead, you should go on VMware VMTN at :
http://www.vmware.com/community/category.jspa?categoryID=113
(damn, you already post there...)
my $vm = Vim::find_entity_views(
view_type => "VirtualMachine",
filter => {'config.template' => '1'}
);
foreach (@$vm) {
eval {
my $vmname = $_->name;
}
}