VMware released recently version 10.0.0 of PowerCLI. One of the major “selling” points for PowerCLI 10.0.0 is the way it works exactly the same regardless of the platform: Windows, Linux, and Mac OS. As a result, immediately after I updated my Windows installation to 10.0.0, I proceeded to install a Linux version of PowerCLI.
I will document in this article how to install PowerShell Core 6.0.1 on Linux and how to install PowerCLI 10.0.0. I will then write about the error I met (“Import-Module : VMware.VimAutomation.Srm module is not currently supported on the Core edition of PowerShell”) and how I solved it. Update 5 May 2018: VMware released a new version 10.1.0, same error is present.
First stop was “Compatibility Matrixes for VMware PowerCLI 10.0.0”. The only supported Linux OS is Ubuntu 16.04. I then installed a VM running this Ubuntu version. I then followed the Microsoft provided instructions to install PowerShell Core 6.0.1. (On a related note, I ran PowerCLI 10.0.0 on CentOS 7 without other issues – except of course for the modules errors).
Install PowerShell Core 6.0.1 on Ubuntu 16.04
First step for PowerShell installation is to import the public repository GPG keys:
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
I then had to register the Microsoft Ubuntu repository.
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
Next I updated Ubuntu list of products.
sudo apt-get update
And finally, I started to install PowerShell Core 6.1.0.
sudo apt-get install -y powershell
Install PowerCLI 10.0.0 on Ubuntu 16.04
I typed “pwsh” to enter PowerShell. Here we can see the PowerShell version 6.0.1. I then ran the normal command to install PowerCLI 10.0.0:
Install-Module -Name VMware.PowerCLI -Scope CurrentUser
Quickly the installer finished its job. I then proceeded with the module import.
Import-Module VMware.PowerCLI
And here is where the magic stopped.
Import-Module : VMware.VimAutomation.Srm module is not currently supported on the Core edition of PowerShell.
At line:1 char:1
+ Import-Module VMware.PowerCLI
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (VMware.VimAutom… of PowerShell.:String) [Import-Module], RuntimeException
+ FullyQualifiedErrorId : VMware.VimAutomation.Srm module is not currently supported on the Core edition of PowerShell.,Microsoft.PowerShell.Commands.ImportModuleCommand
Import-Module : VMware.VimAutomation.Srm module is not currently supported on the Core edition of PowerShell
I found that some of the PowerCLI modules are not compatible with PowerShell Core. For PowerCLI to work, I had to disable some modules from loading when PowerCLI starts. The file where PowerCLI keeps its dependencies is VMware.PowerCLI.psd1. In my case, the full path to the file was:
/home/titi/.local/share/powershell/Modules/VMware.PowerCLI/10.0.0.7895300/VMware.PowerCLI.psd1
Here you will find this section:
# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(
@{“ModuleName”=”VMware.VimAutomation.Sdk”;”ModuleVersion”=”10.0.0.7893910″}
@{“ModuleName”=”VMware.VimAutomation.Common”;”ModuleVersion”=”10.0.0.7893906″}
@{“ModuleName”=”VMware.VimAutomation.Core”;”ModuleVersion”=”10.0.0.7893909″}
@{“ModuleName”=”VMware.VimAutomation.Srm”;”ModuleVersion”=”10.0.0.7893900″}
@{“ModuleName”=”VMware.VimAutomation.License”;”ModuleVersion”=”10.0.0.7893904″}
@{“ModuleName”=”VMware.VimAutomation.Vds”;”ModuleVersion”=”10.0.0.7893903″}
@{“ModuleName”=”VMware.VimAutomation.Vmc”;”ModuleVersion”=”10.0.0.7893902″}
@{“ModuleName”=”VMware.VimAutomation.Nsxt”;”ModuleVersion”=”10.0.0.7893913″}
@{“ModuleName”=”VMware.VimAutomation.vROps”;”ModuleVersion”=”10.0.0.7893921″}
@{“ModuleName”=”VMware.VimAutomation.Cis.Core”;”ModuleVersion”=”10.0.0.7893915″}
@{“ModuleName”=”VMware.VimAutomation.HA”;”ModuleVersion”=”6.5.4.7567193″}
@{“ModuleName”=”VMware.VimAutomation.HorizonView”;”ModuleVersion”=”7.1.0.7547311″}
@{“ModuleName”=”VMware.VimAutomation.PCloud”;”ModuleVersion”=”10.0.0.7893924″}
@{“ModuleName”=”VMware.VimAutomation.Cloud”;”ModuleVersion”=”10.0.0.7893901″}
@{“ModuleName”=”VMware.DeployAutomation”;”ModuleVersion”=”6.5.2.7812840″}
@{“ModuleName”=”VMware.ImageBuilder”;”ModuleVersion”=”6.5.2.7812840″}
@{“ModuleName”=”VMware.VimAutomation.Storage”;”ModuleVersion”=”10.0.0.7894167″}
@{“ModuleName”=”VMware.VimAutomation.StorageUtility”;”ModuleVersion”=”1.2.0.0″}
@{“ModuleName”=”VMware.VumAutomation”;”ModuleVersion”=”6.5.1.7862888″}
)
We need to disable the incompatible modules: VMware.VimAutomation.Srm, VMware.VimAutomation.License, VMware.VimAutomation.vROps, VMware.VimAutomation.HA, VMware.VimAutomation.HorizonView, VMware.VimAutomation.PCloud, VMware.VimAutomation.Cloud, VMware.VimAutomation.DeployAutomation, VMware.VimAutomation.ImageBuilder, and VMware.VimAutomation.VumAutomation. You need to comment each of these lines, by placing a # at the beginning of the line:
#@{“ModuleName”=”VMware.VimAutomation.Srm”;”ModuleVersion”=”10.0.0.7893900″}
#@{“ModuleName”=”VMware.VimAutomation.License”;”ModuleVersion”=”10.0.0.7893904″}
#@{“ModuleName”=”VMware.VimAutomation.vROps”;”ModuleVersion”=”10.0.0.7893921″}
#@{“ModuleName”=”VMware.VimAutomation.HA”;”ModuleVersion”=”6.5.4.7567193″}
#@{“ModuleName”=”VMware.VimAutomation.HorizonView”;”ModuleVersion”=”7.1.0.7547311″}
#@{“ModuleName”=”VMware.VimAutomation.PCloud”;”ModuleVersion”=”10.0.0.7893924″}
#@{“ModuleName”=”VMware.VimAutomation.Cloud”;”ModuleVersion”=”10.0.0.7893901″}
#@{“ModuleName”=”VMware.DeployAutomation”;”ModuleVersion”=”6.5.2.7812840″}
#@{“ModuleName”=”VMware.ImageBuilder”;”ModuleVersion”=”6.5.2.7812840″}
#@{“ModuleName”=”VMware.VumAutomation”;”ModuleVersion”=”6.5.1.7862888″}
Save the file and retry to import PowerCLI module.
And here I am running PowerCLI 10.0.0.7895300 on Ubuntu 16.04!
Great Article, now i’ve got this working on macos aswell. Job well done !
Thank you. This helped with PowerCLI 11.2.0.12780525 with Powershell core 6 as well.