vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
754 stars 603 forks source link

New-HvPool - New-HVPool : Failed to create Pool with error: Cannot find an overload for "VmTemplate_ListByDatacenter" and the argument count: "1". #431

Open TheRealBenForce opened 3 years ago

TheRealBenForce commented 3 years ago

I'm having some trouble making a full clone pool.

New-HVPool : Failed to create Pool with error: Cannot find an overload for "VmTemplate_ListByDatacenter" and the argument count: "1".

Horizon connection server 7.13 Powershell 5.1.18362.1171 VMware.HV.Helper 1.3.1 VMware.Vim 7.0.1.17531376 VMware.VimAutomation.Cis.Core 12.2.0.17531611 VMware.VimAutomation.Common 12.2.0.17531244 VMware.VimAutomation.Core 12.2.0.17531987 VMware.VimAutomation.HorizonView 12.2.0.17463427 VMware.VimAutomation.Sdk 12.2.0.17531155

I suspect this may be due to this line of code: if ($dataCenter -and $dataCenterID) { $VmTemplateInfo = $vm_template_helper.VmTemplate_ListByDatacenter($dataCenterID) if (! ($VmTemplateInfo.Path -like "/$dataCenter/*")) { throw "$template not exists in datacenter: [$dataCenter]" } }

seems to work by passing $services to VmTemplate_ListByDatacenter this way, although I don't have a great test environment to test with different versions of PowerCLI: f ($dataCenter -and $dataCenterID) { $VmTemplateInfo = $vm_template_helper.VmTemplate_ListByDatacenter($services, $dataCenterID) if (! ($VmTemplateInfo.Path -like "/$dataCenter/*")) { throw "$template not exists in datacenter: [$dataCenter]" } }