WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / PowerCLI 13.0 on Photon OS

PowerCLI 13.0 on Photon OS

12.08.2022 by William Lam // 3 Comments

I received a question from Andrea Peetz, asking whether the new Image Builder cmdlets, which is part of the new PowerCLI 13.0 release would work with Photon OS 3.0 (PH3)? After speaking with the PowerCLI team, it looks like Photon OS 3.0 is not compatible with the new cmdlets. If you attempt to use one of the Image Builder cmdlets like Get-EsxSoftwareDepot, you will get the following error:

Unable to cast object of type 'System.IO.FileStream' to type 'System.IO.Pipes.PipeStream'.


With that said, if you do not require the Image Builder cmdlets, then the rest of the PowerCLI cmdlets should work just fine.

While I have not used PH3 for quite some time now, I do use Photon OS 4.0 (PH4) on a regular basis. I was curious if I would have better luck with the new Image Builder cmdlets. Unlike PH3 which ships with Python 3.7, which is the required version for the Image Builder cmdlets, PH4 ships with a newer version of Python which is 3.10 and will not work with PowerCLI. We can still meet this requirement, but we will need to install Python via pyenv.

After a quick test, I was able to get the basic Image Builder cmdlets working and while going through a complete end-to-end workflow to make sure everything was working, I ran into a slightly different issue. When using the Export-EsxImageProfile cmdlet to export an ESXi Image Profile to an ISO file, I got the following error:

Can not instantiate 'certified' policy: VibSign module missing.

Quickly debugging the issue with the PowerCLI team, it looks like the VibSign module that has been compiled has a dependency on OpenSSL 1.1 and PH4 ships with OpenSSL 3.0 by default. Luckily, I was able to find a workaround by building the required file from the latest stable OpenSSL 1.1 release. Once the dependency was fulfilled, I was able successfully complete the Image Builder workflow!


Similiar to PH3, if you do not require the use of the Image Builder cmdlets, PowerCLI 13.0 can be installed on PH4 using the instructions below. If you do need to use the Image Builder cmdlets on PH4, you will need to run Step 2 below as that is a required step. I have also reported both of these issues with the PowerCLI team.

Step 1 - Install Photon OS 4.0 and run the following commands to install the required packages:

tdnf -y update
tdnf -y install wget tar git patch build-essential gcc zlib-devel openssl-devel powershell

Step 2 - Download and compile the latest stable OpenSSL 1.1 release (1.1.1.s is latest version as of this blog post) and copy the shared library file to /usr/lib directory by running the following commands:

wget https://www.openssl.org/source/openssl-1.1.1s.tar.gz
tar -zxvf openssl-1.1.1s.tar.gz
cd openssl-1.1.1s/
./config
make
cp libcrypto.so.1.1 /usr/lib

Step 3 - Next, we need to setup pyenv to install the specific Python version that PowerCLI 13.0 supports which is 3.7.x. Clone the pyenv github repo and setup the required paths by running the following commands:

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile

Step 4 - Install Python 3.7 and the required Python packages by running the following commands:

pyenv install 3.7
pyenv global 3.7.16
pip3 install six psutil lxml pyopenssl

Step 5 - Lastly, launch PowerShell and install PowerCLI by running the following commands:

pwsh
Install-Module VMware.PowerCLI
Set-PowerCLIConfiguration -PythonPath /root/.pyenv/shims/python3.7

More from my site

  • Heads Up - Unable to open VIB archive in streaming mode using Export-EsxImageProfile with PowerCLI 13.0
  • How to create a customized ESXi ISO without vCenter Server?
  • Identifying ESXi boot method & boot device
  • Deploying NSX-T VIBs and/or creating custom NSX-T Image Profile
  • Custom script bundle is now possible with Auto Deploy in vSphere 6.5

Categories // Automation, PowerCLI Tags // auto deploy, image builder, PowerCLI

Comments

  1. *protectedjeremycirca1980 says

    01/12/2023 at 2:56 pm

    I built a Docker Container that runs PowerCLI 13 with Image Builder support. I'm a Mac user and didn't always have access to a Windows machine to run PowerCLI with Image Builder so, when I saw PowerCLI 13 came out, I jumped for joy. Anyways, I get a lot of my information from William Lam and this website so, I wanted to share the link to the Container. I hope that is OK and I hope it helps someone out as much as it helps me out.

    https://hub.docker.com/r/jmcombs/vmware-powercli

    Reply
  2. *protectedRichard July says

    09/13/2024 at 12:08 am

    I was wondering if there were any updates about using Powercli 13 with Photon 4? I was successfully able to use it with your Automated Lab Deployment Script for VCF 4.2 about two years ago, but I am now failing using the same photon 4 config trying to get the current script to run. Is there a particular version of powershell or powercli I need to use? Many thanks for sharing your excellent work...

    Reply
    • *protected*protected email* says

      09/13/2024 at 2:51 am

      Got it sorted.. many thanks!

      - Richard

      Reply

Thanks for the comment!Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...