PowerCLI-Example-Scripts
PowerCLI-Example-Scripts copied to clipboard
[VMware.Hv.Helper] Add-HvDesktop timing out
Describe the bug
When trying to run the above PowerCLI command we are receiving intermittent timeouts after100 seconds.
Does anyone know how to increase the timeout? We have a relatively large inventory of 5000 VMs which I think may be the cause.
e.g.
Exception calling "VirtualMachine_List" with "2" argument(s): "The request channel timed out while waiting for a reply after 00:01:39.9989887. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout." At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:526 char:3
- $vcMachines = $virtualMachine_helper.VirtualMachine_List($services, ...
-
- CategoryInfo : NotSpecified: (:) [], MethodInvocationException
- FullyQualifiedErrorId : TimeoutException
Add-HVDesktop : Failed to get any Virtual Center machines with the given machines parameter At line:1 char:5
- Add-HVDesktop -PoolName GCS_General -Machines VWMRXGCSLGY059 -Vce ...
-
- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Add-HVDesktop
Lines 522-537;
function Get-MachinesByVCenter ($MachineList,$VcId) {
[VMware.Hv.MachineId[]]$machines = $null $virtualMachine_helper = New-Object VMware.Hv.VirtualMachineService $vcMachines = $virtualMachine_helper.VirtualMachine_List($services,$vcId) $machineDict = @{} foreach ($vMachine in $vcMachines) { $machineDict.Add($vMachine.name,$vMachine.id) } foreach ($machineName in $machineList) { if ($machineDict.Contains($machineName)) { $machines += $machineDict.$machineName } } return $machines }
Reproduction steps
1. Add-HVDesktop -PoolName Project_Windows_10 -Machines VWMRXPRJ10DV007 -Vcenter acprdtewwvcs02.*.com -HvServer $hv
Expected behavior
VM added to Horizon Pool
Additional context
No response