Hi Everyone,
In Ubuntu-20.04.3 VM, Import PowerCLI module is failing with the below exception hence Get-Module command is not listing VMware.PowerCLI module.
PS /> Import-Module VMware.PowerCLI
Exception: The VMware.ImageBuilder module is not currently supported on the Core edition of PowerShell.
When I check in the VMware.ImageBuilder.psm1 code, could see this exception is throwing in the condition if PSEdition is not ‘Desktop’
VMware.ImageBuilder.psm1 -https://www.powershellgallery.com/packages/VMware.ImageBuilder/7.0.3.19195798/Content/VMware.ImageBu...
But my Ubuntu VM PSEdition is Core and so the above exception is throwing.
Due to this , I am unable to run the 3rd party inspec scripts(which use powercli) which is throwing the below error.
Error- Unable to determine PowerCLI Module version, is it installed?
Do we have any other solution/workaround to import PowerCLI module into the current session in linux? If so please advise/ provide your comments.
Setup details:
PS /> Get-PowerCLIVersion
VMware.PowerCLI 12.5.0 build 19195797
PS /> $PSVersionTable
Name Value
---- -----
PSVersion 7.2.1
PSEdition Core
GitCommitId 7.2.1
OS Linux 4.15.0-163-generic #171-Ubuntu SMP Fri Nov 5 11:55:11 UTC 2021
Platform Unix
PSCompatible Versions {1.0, 2.0, 3.0, 4.0…}
PSRemoting ProtocolVersion 2.3
Serialization Version 1.1.0.1
WSManStack Version 3.0
The ImageBuilder module has not yet been ported to PS Core.
There is, besides using PSv5.1 on a supported platform, no bypass for this I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The same is valid for DeployAutomation module as well.
My script is pretty simple (by comparison) and I only really need the core functionality. I got around this by *not* importing all Vmware.powercli, instead I just ran VMware.VimAutomation.Core. First time I've had to use that trick, and it worked well. Module loads much faster!!
#Requires -Version 7
#Requires -Modules VMware.VimAutomation.Core
import-module VMware.VimAutomation.Core -Verbose
Hi, here is the information of the module's manifest file:
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @(
'VMware.VimAutomation.ViCore.Interop.dll',
'VMware.VimAutomation.ViCore.Cmdlets.dll',
'VMware.VimAutomation.ViCore.Impl.dll',
'VMware.VimAutomation.ViCore.Types.dll',
'VMware.VimAutomation.ViCore.Util10.dll',
'VMware.VimAutomation.ViCore.Util10Ps.dll'
)
However, I've downloaded all of the PowerCLI modules and just Import the Core one. And the operation was successful
Maya
Why, o why, all this explicit module importing?
Let module auto-loading do its work 😂
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference