VMware Cloud Community
crosen
Contributor
Contributor

Resource Pool doesn't always populate

All of my VMs are in a resource pool, but this script will sometimes return "Resources" instead of the actual RP name and I don't know why...

$row.Resourcepool = (Get-ResourcePool -VM $vm).Name

full function:

function vCell01Data {
    $filename1 = 'C:\MyDocs\work\Virtualization\VMWare\VMware_Healthcheck\List_VMs_By_Exec\vms_by_exec_vcell01.csv'
    $VIServer = "rtpvcell70"
    write-host ("Working on VM List for $VIServer....")
    connect-viserver -server $VIServer -user $User -password $Password
    $report = @()
    foreach($vm in Get-VM){
        $guest = Get-VMGuest -VM $vm   
        $row = "" | Select VMName,Notes,vCenter,IPAddr,Owner1,Owner2,VP,Resourcepool

        $row.VMName = $vm.Name
        $notesfield = $VM.Description
        $row.Notes = ($notesfield -replace ",",";")
        $row.vCenter = $VIServer
        $row.IPAddr = $guest.IPAddress[0]
        $row.Owner1 = ""
        $row.Owner2 = ""
        $row.Resourcepool = (Get-ResourcePool -VM $vm).Name

        $report += $row   
    }
    $report | Export-Csv "$filename1" -NoTypeInformation -UseCulture
    Disconnect-VIServer -Confirm:$False
}

0 Kudos
3 Replies
LucD
Leadership
Leadership

That is an actual resourcepool.

There is a hidden resourcepool, called Resources.

In there you will find the VMs that are in the root of a cluster, but not in any of the cluster's resourcepools.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
crosen
Contributor
Contributor

How do I unhide that RP and see what is in there?  Thanks.

0 Kudos
LucD
Leadership
Leadership

I'm afraid there is no procedure to unhide those hidden folders.

You can check which VMs are in there with

Get-Cluster MyCluster | Get-ResourcePool -Name Resources | Get-VM -NoRecursion

In the vSphere client these are the VMs that sit in the root of the cluster.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos