VMware Cloud Community
Anishkumarv
Enthusiast
Enthusiast

the number of waithandles must be less than 64 error when i run the script.

Dear power cli guys,

Why i am getting this error when i run the script. how to avoid this ? i am running .net 4.5 with power cli 5.0.

Kindly guide me to solve this thread.

what modification i need to do in this script to avoid this error.

$esx = Get-Content "C:\Users\KVaishali.admin-PC\Desktop\vmlit.txt"

Connect-VIServer $esx -User XXX -Password XXXX

&{

  Get-VMHost | Foreach-Object {

    $mioThisHostsDStoreInfo = Get-Datastore -VMHost $_ | Measure-Object -Property CapacityGB,FreeSpaceGB -Sum

    $dblCapGB = ($mioThisHostsDStoreInfo | ?{$_.Property -eq "CapacityGB"}).Sum        ## datastore capacity

    $dblFreeGB = ($mioThisHostsDStoreInfo | ?{$_.Property -eq "FreeSpaceGB"}).Sum    ## datastore free

    Select -InputObject $_ @{n="hostname"; e={$_.NetworkInfo.HostName}},

   @{n="IP"; e={$_.name}},

    Model,ProcessorType,CpuTotalMhz,CpuUsageMhz,

    @{n="CputAvailableMhz"; e={$_.CpuTotalMhz - $_.CpuUsageMhz}},MemoryTotalGB,MemoryUsageGB,

     @{n="MemAvailableGB"; e={$_.MemoryTotalGB - $_.MemoryUsageGB}},

     @{n="TotalDStoreSizeGB"; e={$dblCapGB}},

      @{n="DStoreUsedGB"; e={$dblCapGB - $dblFreeGB}},

      @{n="DStoreAvailableGB"; e={$dblFreeGB}},

      @{n="Cpu Count"; e={$_.Numcpu}},

       @{n="PNicCount"; e={($_.NetworkInfo.PhysicalNic | Measure-Object).Count}}

}

} | Export-Csv -Path "VMs.csv" -NoTypeInformation -UseCulture

With Regards

Anish Kumar.V

0 Kudos
1 Reply
LucD
Leadership
Leadership

That error was mentioned before, see Broke powershell, "The number of WaitHandles must be less than or equal to 64"

But there is no solution or answer posted.

Perhaps post in the thread above if there ever was a fix.

Or perhaps the PowerCLI Dev Team could tell us why this might be happening ?


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

0 Kudos