As powershell ISE is going to be phased out we are switching to Visual Studio Code - hower the powercli modules seems not to run with powershel core 7 i VSC. When will there be a powercli version compatible with powershell core 7?
Which PowerCLI version are you using?
Recent versions are compatible with PSv7
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Powercli 12.4.1
I get this error when running powercli commands
Exception: The VMware.ImageBuilder module is not currently supported on the Core edition of PowerShell.
Not all PowerCLI modules and some cmdlets are already migrated to PS Core.
This might be due to APIs that are not available (all VICredentialStoreItem cmdlets that depend on MSFT's DPAPI methods) or some VMware Teams, responsible for a specific module, that have not yet ported their module to PS Core (ImageBuilder is one of those).
The majority of the 600+ PowerCLI cmdlets do work in PS Core.
When you are using a Windows platform, you can use PSv5.1 and PSV7.* side-by-side, and both from VSC.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
If you want to produce a list of modules that are not supported in your current version of PowerCLI, you can run the following snippet.
$shell = New-Object -ComObject Shell.Application
Get-Module -Name 'VMware.*' -ListAvailable |
Select-Object Name, Version,
@{N = 'Date'; E = {
$script:fName = ($_.Path -replace '.psd1', '.cat')
if (Test-Path -Path $script:fName)
{
$script:folder = Split-Path -Path $script:fName -Parent
$file = Split-Path -Path $script:fName -Leaf
$sFolder = $shell.Namespace($script:folder)
$sFile = $sFolder.ParseName($file)
$sFolder.GetDetailsOf($sFile, 3)
}
else { 'na' }
}
},
@{N = 'Core'; E = {
if($_.CompatiblePSEditions -contains 'Core'){
$true
}
elseif ($_.Name -ne 'VMware.PowerCLI')
{
Test-Path -Path "$($script:folder)\netcoreapp2.0"
}
else { 'na' } }
} |
Format-Table -AutoSize
If you want to check which specific cmdlets, in modules that are supported in Core, are not supported, you can run something like this
Get-Module -Name VMware.* -ListAvailable -PipelineVariable module |
ForEach-Object -Process {
Get-ChildItem -Path $module.ModuleBase -Directory -Filter "net*" |
ForEach-Object -Process {
Get-ChildItem -Path $_.FullName -Filter "*.Cmdlets.dll-Help.xml" |
ForEach-Object -Process {
[xml]$help = Get-Content -Path $_.FullName
$help.helpItems.command |
ForEach-Object -Process {
New-Object PSObject -Property ([ordered]@{
Module = $module.Name
Cmdlet = "$($_.details.verb)-$($_.details.noun)"
Core = -not ($_.alertset.alert.para -match "This cmdlet is not supported on the Core edition of PowerShell.")
})
}
}
}
} | where { -not $_.Core } | Sort-Object -Property Module, Cmdlet
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference