NetBoxBlue
Contributor
Contributor

Can I list resource pools via a command line tool?

Jump to solution

I am trying to find out if I can figure out if a VM is in a resource pool using a remote command line. This could be as simple as getting a list of the resource pools available on a host, or listing if a VM is a member of a resource pool. Any ideas anyone?

I have tried the tools provided with vmware-viperl (guestinfo.pl and vminfo.pl) and vmware-cmd (as well as other tools that were not even close).

Thanks.

1 Solution

Accepted Solutions
lamw
Community Manager
Community Manager

Take a look at this script which extracts this information without having to use the unsupported ESXi console:

You'll need to install the vSphere SDK for Perl OR use [vMA|http://www.vmware.com/support/developer/vima/index.html

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
10 Replies
AndreTheGiant
Immortal
Immortal

I'm not sure that is it possible using a simple CLI.

See also those threads:

Andre

Andre | http://about.me/amauro | http://vinfrastructure.it/ | @Andrea_Mauro
bulletprooffool
Champion
Champion

Try powershell . .

something like:

$report = @()

$vms = Get-VM

foreach ($vm in $vms){

foreach($hd in $vm | Get-HardDisk){

$row = "" | select VMname, VMdisksize, server, resrcepool

$row.VMname = $vm.Name

$row.VMdisksize = $hd.CapacityKB

$row.server = ($vm | Get-VMHost).Name

$row.resrcpool = ($vm | Get-ResourcePool).Name

$report += $row

}

}

$report | Export-Csv "C:\report.csv" -noTypeInformation

One day I will virtualise myself . . .
NetBoxBlue
Contributor
Contributor

That's looking closer... but I forgot to mention that I wanted to do this from Linux. Smiley Happy

Is there maybe a way to download the file /etc/vmware/hostd/pools.xml remotely? (even if it is unsupported)

Thanks.

0 Kudos
lamw
Community Manager
Community Manager

Take a look at this script which extracts this information without having to use the unsupported ESXi console:

You'll need to install the vSphere SDK for Perl OR use [vMA|http://www.vmware.com/support/developer/vima/index.html

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

View solution in original post

0 Kudos
NetBoxBlue
Contributor
Contributor

Perfect! That is exactly what I need.

Thanks.

0 Kudos
KKrtz
Contributor
Contributor

Hello.

I've already implemented your tool ghettoVCBg2 in combination with an mail function. The only thing which I'am now need is an possibility to select my VMs via an named resource pool.

e.g. on both servers (esxi) my productive vm's are located in the pool "prod". now i want to get an list with all machines in the pool prod which I can use with ghettovcbg2

Probably it's possible to downstrip or customize your resource pl script

Thanks.

0 Kudos
lamw
Community Manager
Community Manager

Sure, just modify the script so output a specific resource pool name. I also recommend creating a new thread and not hop onto one that's already been answered, that way you're sure someone will see this marked as a new quesiton.

=========================================================================

William Lam

VMware vExpert 2009

VMware ESX/ESXi scripts and resources at:

VMware Code Central - Scripts/Sample code for Developers and Administrators

VMware Developer Comuunity

Twitter: @lamw

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
BigBear
Contributor
Contributor

How do I get a look at this linux script? I can't see or foolwo the links, are they dead?

0 Kudos
wdbarker
Enthusiast
Enthusiast

That would be very helpful if the script were available. Where can I see it?

0 Kudos
pkirklewski
Enthusiast
Enthusiast

me too,

The script is not available, please fix.

0 Kudos