I have installed PowerCLI 6.5.4 using the below link
https://www.powershellgallery.com/packages/VMware.PowerCLI/6.5.4.7155375
Install-Module -Name VMware.PowerCLI -RequiredVersion 6.5.4.7155375
I can see it is installing "VMware PowerCLI 11.0.0 build 10380590" even if I am asking it to install 6.5.4.7155375 version.
Also I can see it is downloading the updated version of each dependent module.
When I create a new vm using the below command. It is failing with the error.
Please help.
$New_VM = New-VM -VMHost $VMHost -Name $Name -Datastore $Datastore -Template $Template
Error
[Main] ERR[1-01-000-0004] : [New-VM|832] Failed to Provision VM. |Reason: 2/19/2019 5:05:07 PM New-VM Could not obtain the result of task '/VIServer=vsphere.local\xxxx@xx.xx.xx.xx:xx/Task=Task-task-938/'. Task name is'CloneVM_Task'. The following error occured: Method not found: 'VMware.VimAutomation.ViCore.Interop.V1.VIAutomation VMware.VimAutomation.ViCore.Interop.V1.VIObjectCoreInterop.get_Client()'.
--------------------------------------------------------------------------------------------------------------------------------
PS C:\Users\Administrator.SA> Get-PowerCLIVersion
WARNING: The cmdlet "Get-PowerCLIVersion" is deprecated. Please use the 'Get-Module' cmdlet instead.
PowerCLI Version
----------------
VMware PowerCLI 11.0.0 build 10380590
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 11.0 build 10335701
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.0 build 10336080
VMware Vds PowerCLI Component 6.5 build 5374428
VMware Cloud PowerCLI Component 6.5 build 5375799
VMware PCloud PowerCLI Component 6.5 build 5376282
VMware Storage PowerCLI Component 6.5 build 7154886
VMware HorizonView PowerCLI Component 7.1.0 build 10230451
VMware High Availability PowerCLI Component 6.0 build 000000
VMware vROps PowerCLI Component 6.5 build 5375723
VMware vSphere Update Manager PowerCLI 6.5 build 7862888
VMWare ImageBuilder PowerCLI Component 6.7 build 8250345
VMWare AutoDeploy PowerCLI Component 6.7 build 8250345
VMware Licensing PowerCLI Component 6.5 build 5375648
--------------------------------------------------------------------------------------------------------------
PS C:\Users\Administrator.SA> Get-module -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
Script 6.7.0.8... VMware.DeployAutomation {Add-DeployRule, Add-ProxyServer, Add-ScriptBundle, Copy-D...
Script 6.7.0.8... VMware.ImageBuilder {Add-EsxSoftwareDepot, Add-EsxSoftwarePackage, Compare-Esx...
Manifest 6.5.4.7... VMware.PowerCLI
Script 6.7.0.1... VMware.Vim
Script 11.0.0.... VMware.VimAutomation.Cis.Core {Connect-CisServer, Disconnect-CisServer, Get-CisService}
Binary 6.5.1.5... VMware.VimAutomation.Cloud {Add-CIDatastore, Connect-CIServer, Disconnect-CIServer, G...
Script 11.0.0.... VMware.VimAutomation.Common
Script 11.0.0.... VMware.VimAutomation.Core {Add-PassthroughDevice, Add-VirtualSwitchPhysicalNetworkAd...
Script 6.5.4.7... VMware.VimAutomation.HA Get-DrmInfo
Script 7.6.0.1... VMware.VimAutomation.HorizonView {Connect-HVServer, Disconnect-HVServer}
Binary 6.5.1.5... VMware.VimAutomation.License Get-LicenseDataManager
Binary 2.0.0.6... VMware.VimAutomation.Nsxt {Connect-NsxtServer, Disconnect-NsxtServer, Get-NsxtService}
Binary 6.5.1.5... VMware.VimAutomation.PCloud {Connect-PIServer, Disconnect-PIServer, Get-PIComputeInsta...
Script 11.0.0.... VMware.VimAutomation.Sdk {Get-ErrorReport, Get-InstallPath, Get-PSVersion}
Binary 6.5.1.5... VMware.VimAutomation.Srm {Connect-SrmServer, Disconnect-SrmServer}
Binary 6.5.4.7... VMware.VimAutomation.Storage {Add-KeyManagementServer, Copy-VDisk, Export-SpbmStoragePo...
Script 1.3.0.0 VMware.VimAutomation.StorageUtility Update-VmfsDatastore
Binary 6.5.1.5... VMware.VimAutomation.Vds {Add-VDSwitchPhysicalNetworkAdapter, Add-VDSwitchVMHost, E...
Binary 6.5.4.7... VMware.VimAutomation.Vmc {Connect-Vmc, Disconnect-Vmc, Get-VmcService, Connect-VmcS...
Binary 6.5.1.5... VMware.VimAutomation.vROps {Connect-OMServer, Disconnect-OMServer, Get-OMAlert, Get-O...
Script 6.5.1.7... VMware.VumAutomation {Add-EntityBaseline, Copy-Patch, Get-Baseline, Get-Complia...
If you can, go for PS v5.1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you already try with
Install-Module
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes I have tried this as well. However I dont see how this is different than Install-Module -Name VMware.PowerCLI -RequiredVersion 6.5.4.7155375
Note: I tried it on a fresh server.
Which PowerShell version are you using?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
PS C:\Users\Administrator.SA> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.42000
BuildVersion 6.3.9600.17400
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
Is there a reason you are on PS v4?
Can you upgrade to PS v5.1?
The module versioning with PS v4 had some flaws.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Compatibility matrix says Powershell version supported is 3.0 and above.
So I did not think that i will find an issue in PS4.
I will upgrade to PS5 and try it. Thanks
If you can, go for PS v5.1
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference