Skip to content

PowerCLI

NOT_AUTHENTICATED Error with PowerCLI 13.1 - Cloud Director Authentication Changes

After updating PowerCLI to version 13.1, which has been released in April 2023, a couple of scripts that are using the Session Token provided by Connect-CIServer fail to work with the following error:

Invoke-WebRequest: {"minorErrorCode":"NOT_AUTHENTICATED","message":"[] This operation is denied.","stackTrace":null}

According to the official announcement, there have been changes to the authentication mechanism of Connect-CIServer. This change does not affect any functions that come with PowerCLI, but many community functions and scripts that include custom API calls.

In previous versions, you could simply snatch the authentication token that is stored in the $global:DefaultCIServers.SessionId global variable and use with an x-vcloud-authorization header in your custom API calls. Since PowerCLI 13.1, you now get a Bearer Token as SessionId/SessionSecret.

Read More »NOT_AUTHENTICATED Error with PowerCLI 13.1 - Cloud Director Authentication Changes

How to Install PowerCLI 13 with Python 3.7 on Windows (Required for ImageBuilder)

With the release of PowerCLI 13, VMware has introduced some major enhancements. One of the most exciting features is that PowerCLI is now fully Multi-platform, which means that all functions are available for all PowerShell Core supported operating systems including Windows, macOS, and Linux. If you are planning to use the ImageBuilder module, you will need to have Python 3.7 installed on your machine.

If you want to use ImageBuilder-based commands in PowerCLI 13, you might see the following error:

Add-EsxSoftwareDepot: Could not initialize the VMware.ImageBuilder PowerCLI module. Make sure that Python 3.7 is installed and that you have set the path to the Python executable by using Set-PowerCLIConfiguration -PythonPath. See the PowerCLI Compatibility Matrixes for information on the Python requirements.

This article explains how to install and configure PowerCLI 13 with Python 3.7 to be ready to use ImageBuilder.

Read More »How to Install PowerCLI 13 with Python 3.7 on Windows (Required for ImageBuilder)

Installing or removing packages fails with "BOOTx64.EFI not found" error - ESXi 7.0

While preparing my ESXi Hosts for the recently released ESXi 7.0 Update 3, I came across a strange issue. When I try to install or remove any packages using esxcli, the update failed with the following error message:

[KeyError]
"filename 'var/db/payloads/boot_loader_efi/BOOTx64.EFI' not found"
Please refer to the log file for more details.

Any updates using Update Manager / Lifecycle Manager did also fail. ESXi was running at 7.0.2 build-17867351, which correlates to ESXi 7.0 Update 2a. Using "esxcli software profile list" reveals that this was a fresh installation and no packages have been updated yet. The image was customized by adding the vmkusb-nic-fling using PowerCLI Image Builder. After some troubleshooting, I was able to reproduce the Issue which helped me to identify the root cause and I also found a solution to make updates functional again.

Read More »Installing or removing packages fails with "BOOTx64.EFI not found" error - ESXi 7.0

How to add the USB NIC Fling to ESXi 7.0 Base Image

Many people are using the USB NIC Fling by William Lam and Songtao Zheng in homelabs. To make a fresh installation or upgrade as simple as possible, I've created a new Image Profile that contains the USB NIC driver.

This article explains how to create a custom ESXi 7.0 Image including the NIC driver to either upgrade previous versions of ESXi or make a fresh  ESXi installation with USB NIC support.

Read More »How to add the USB NIC Fling to ESXi 7.0 Base Image

Export-ESXImageProfile fails with WinError 10054

When creating an ESXi ISO Image from VMware's Online Depot by using the PowerCLI command Export-ESXImageProfile -ExportToISO, the creation might fail with the following error message:

Export-ESXImageProfile : [WinError 10054] An existing connection was forcibly closed by the remote host

Creating an offline .zip bundle (-ExportToBundle) works without any problems. To work around this issue, create the .zip bundle first and then create the .iso file from the local software depot.Read More »Export-ESXImageProfile fails with WinError 10054

How to check NVMe Drives TBW in ESXi with PowerCLI

When working with SSDs, you have to keep an eye on its TBW ("Total Bytes Written" or "Terabytes Written"). A maximum TBW guarantee is typically provided by the vendor in their specifications. This value describes how data can be written to the entire device until the warranty expires. The current value can be checked with S.M.A.R.T.

This article explains how to check the TBW value on NVMe based drives running in an ESXi host with PowerShell or from the command line. If you have a SATA based SSD drive, check this article.

Read More »How to check NVMe Drives TBW in ESXi with PowerCLI

Get- and Set-VMLatencySensitivity PowerShell Function

The Get-VMLatencySensitivity, Get-VMLatencySensitivityBulk and Set-VMLatencySensitivity PowerShell functions configure can return and set the latency sensitivity level of a virtual machine. You can adjust the latency sensitivity of a virtual machine to optimize the scheduling delay for latency sensitive applications.

The function is part of my Virten.net.VimAutomation module, which is a set of PowerShell function built for managing, troubleshooting and automating VMware based platforms. The module can be easily obtained from the PowerShell Gallery and is available on GitHub.

Read More »Get- and Set-VMLatencySensitivity PowerShell Function

Get-VMHostVersion and Get-VMHostLatestVersion PowerShell Function

The Get-VMHostVersion and Get-VMHostLatestVersion PowerShell functions are aimed at helping you to identify the version at which your ESXi is currently running, and whether updates are available. Both are using a JSON based ESXi Build database which is also the backend for the ESXi Build Number History provided by virten.net.

The function is part of my Virten.net.VimAutomation module, which is a set of PowerShell function built for managing, troubleshooting and automating VMware based platforms. The module can be easily obtained from the PowerShell Gallery and is available on GitHub.

Read More »Get-VMHostVersion and Get-VMHostLatestVersion PowerShell Function