{"id":190,"date":"2021-03-04T00:01:01","date_gmt":"2021-03-03T22:01:01","guid":{"rendered":"https:\/\/my-virt.alfadir.net\/?p=190"},"modified":"2021-03-04T23:18:36","modified_gmt":"2021-03-04T21:18:36","slug":"powercli-and-vmware-horizon-error-baseimagevm_list","status":"publish","type":"post","link":"https:\/\/my-virt.alfadir.net\/index.php\/2021\/03\/04\/powercli-and-vmware-horizon-error-baseimagevm_list\/","title":{"rendered":"PowerCLI and VMware Horizon.. error BaseImageVM_List"},"content":{"rendered":"\n<p>PowerShell and more specifically <a href=\"https:\/\/code.vmware.com\/web\/tool\/12.2.0\/vmware-powercli\" data-type=\"URL\" data-id=\"https:\/\/code.vmware.com\/web\/tool\/12.2.0\/vmware-powercli\">VMware PowerCLI<\/a> (who are the PowerShell commands to manage VMware Infrastructure with around 800 cmdlets) are incredible tools who extremely facilitate administrators day to day life&#8230;<\/p>\n\n\n\n<p>Now sometime it happens, after an upgrade, that didn&#8217;t work any more as expected.<\/p>\n\n\n\n<p>In order to manage Horizon deployment using PowerShell scripts, using PowerCLI is not enough and you need to add the <a href=\"https:\/\/github.com\/vmware\/PowerCLI-Example-Scripts\/tree\/master\/Modules\/VMware.Hv.Helper\" data-type=\"URL\" data-id=\"https:\/\/github.com\/vmware\/PowerCLI-Example-Scripts\/tree\/master\/Modules\/VMware.Hv.Helper\">VMware.HV.Helper<\/a> modules who contains many commands and more especially the New-HVPool one in order to create Horizon pools.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Basically, if you want to manage VMware stuff you only need to run the following command : <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Install-Module VMware.PowerCLI -AllowClober -Scope {CurrentUser | AllUsers}<\/code><\/pre>\n\n\n\n<p>CurrentUser will install in :<br>   <em>$home\\Documents\\WindowsPowerShell\\Modules<\/em><br>When<br>AllUsers will install PowerCLI in :<br>   <em>C:\\ProgramFiles\\WindowsPowerShell\\Modules<\/em><\/p>\n\n\n\n<p>Now, unfortunately, if you install the latest version of the VMware PowerCLI  (12.2.0) and try to deploy an Horizon Pool with the New-HVPool command, it will fail with the following error : <\/p>\n\n\n\n<p><em>&#8220;New-HVPool : Failed to create Pool with error: Cannot find an overload for &#8220;BaseImageVm_List&#8221; and the argument count: &#8220;2&#8221;&#8221;<\/em><\/p>\n\n\n\n<p>This issue is being investigated as show in <a href=\"https:\/\/github.com\/vmware\/PowerCLI-Example-Scripts\/issues\/397\" data-type=\"URL\" data-id=\"https:\/\/github.com\/vmware\/PowerCLI-Example-Scripts\/issues\/397\">this thread on GitHub<\/a> but until it&#8217;s fixed we need to have a workaround to make it works&#8230; and this workaround it to use PowerCLI 12.0.0, so, if you have already installed PowerCLI 12.2.0, the first thing to do is to remove it by deleting all folders starting by <em>VMware.*<\/em> in the installation directory <strong>but not VMware.Hv.Helper<\/strong> (you need to keep it).<\/p>\n\n\n\n<p>And the second thing is to download and install PoweCLI 12.0.0 from the .ZIP file. You can download it <a href=\"https:\/\/vdc-download.vmware.com\/vmwb-repository\/dcr-public\/2802fdb1-bca3-4875-b76f-901cb15c2b2a\/509b4a98-5ee5-4048-9407-28b9f85ba65c\/VMware-PowerCLI-12.0.0-15947286.zip\">here<\/a>.<\/p>\n\n\n\n<p>Once extracted copy all files and folders to PowerShell&#8217;s module directory and run the following command to let PowerShell the ability to use them by unblocking files downloaded from Internet:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-ChildItem -Path 'C:\\Program Files\\WindowsPowerShell\\Modules\\' -Recurse | Unblock-File<\/code><\/pre>\n\n\n\n<p>You can check that all modules are here by using this command :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Get-Module -ListAvailable VMware*<\/code><\/pre>\n\n\n\n<p>You should have the following results :<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"355\" src=\"https:\/\/my-virt.alfadir.net\/wp-content\/uploads\/2021\/03\/image-1024x355.png\" alt=\"\" class=\"wp-image-191\" srcset=\"https:\/\/my-virt.alfadir.net\/wp-content\/uploads\/2021\/03\/image-1024x355.png 1024w, https:\/\/my-virt.alfadir.net\/wp-content\/uploads\/2021\/03\/image-300x104.png 300w, https:\/\/my-virt.alfadir.net\/wp-content\/uploads\/2021\/03\/image-768x267.png 768w, https:\/\/my-virt.alfadir.net\/wp-content\/uploads\/2021\/03\/image.png 1423w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can now deploy Instant Clone VM using PowerShell&#8230;<\/p>\n\n\n\n<p>References:<br><em><a href=\"https:\/\/roderikdeblock.com\/create-horizon-desktop-pool-using-powercli\/\" data-type=\"URL\" data-id=\"https:\/\/roderikdeblock.com\/create-horizon-desktop-pool-using-powercli\/\">Create Horizon Desktop Pool using PowerCLI<\/a> by RODERIK DE BLOCK<br><a href=\"https:\/\/code.vmware.com\/web\/tool\/12.0.0\/vmware-powercli\">VMware PowerCLI 12.0.0 Download<\/a><br><a href=\"https:\/\/github.com\/vmware\/PowerCLI-Example-Scripts\/\" data-type=\"URL\" data-id=\"https:\/\/github.com\/vmware\/PowerCLI-Example-Scripts\/\">PowerCLI-Example-Scripts<\/a> on GitHub<\/em><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>PowerShell and more specifically VMware PowerCLI (who are the PowerShell commands to manage VMware Infrastructure with around 800 cmdlets) are incredible tools who extremely facilitate administrators&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-190","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/posts\/190","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/comments?post=190"}],"version-history":[{"count":4,"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/posts\/190\/revisions\/195"}],"wp:attachment":[{"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/media?parent=190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/categories?post=190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/my-virt.alfadir.net\/index.php\/wp-json\/wp\/v2\/tags?post=190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}