VMware Cloud Community
DCasota
Expert
Expert

VMware.Imagebuilder cmdlets on PSCore on Linux

Hi,

I just wonder if VMware.ImageBuilder could get support on PSCore on Linux? I would use it!

Tinkered around with VMware Photon OS and came to a point where it would be nice to use VMware.ImageBuilder cmdlets Add-EsxSoftwareDepot, Export-EsxImageProfile, etc. and not to provision a temporary Windows box.

Actually on a compatibility approach (no refactoring), the cmdlets are registered and start, but fails. Here's the output from ESXi customizer :

Running with PowerShell version 6.2 and VMware PowerCLI version 11.5.0.14899560

Connecting the VMware ESXi Online depot ...

An unexpected error occured:

The type initializer for 'VMware.ImageBuilder.Impl.IfServer' threw an exception.

If requesting support please be sure to include the log file

   \ESXi-Customizer-PS-80617.log

Logfile entry: TerminatingError(Add-EsxSoftwareDepot): "The type initializer for 'VMware.ImageBuilder.Impl.IfServer' threw an exception."

Facing that ./VMware.ImageBuilder/6.7.0.11233116/net45 includes a magic sausage of if-server.exe, windows dlls, python files, etc., well, workarounds like if-server.exe on mono didn't work (missing .CIL), I'm not enthusiastic anymore that the compatibility workaround approach is easy. As said, it's a study work.

The recipe so far was

1) VMware Photon OS 3.0rev2

2) Mono Framework 6.4 (for .net assembly files, see below)

3) Powershell Core 6.2.3

4) PowerCLI 11.5

5) Copy /usr/local/lib/mono/4.5/* /root/.local/share/powershell/Modules/VMware.ImageBuilder/6.7.0.11233116/net45/

     Without assembly System.Web.Services, import-module VMware.ImageBuilder.psd1 -passthru fails. It might be possible to save the .Net 4.5 files in another way than installing Mono.

6) Modified /root/.local/share/powershell/Modules/VMware.ImageBuilder/6.7.0.11233116/VMware.Imagebuilder.psm1:

   #if (($PSVersionTable.Keys -contains "PSEdition") -and ($PSVersionTable.PSEdition -ne 'Desktop')) {

   #        Throw "The VMware.ImageBuilder module is not currently supported on the Core edition of PowerShell."

   #}

   #else {

        $PSModuleRoot="/root/.local/share/powershell/Modules/VMware.ImageBuilder/6.7.0.11233116"

        $binaryModuleRoot = Join-Path -Path $PSModuleRoot -ChildPath 'net45'

   #}

7) ESXi-Customizer-PS-v2.6.0.ps1 from v-front.de

Tags (1)
Reply
0 Kudos
0 Replies