@TX_Tundra,
Thanks. I was able to get desired results with:
function Get-EncryptionRecoveryKeys {
$esxiHosts = get-vmhost | Where { $_.PowerState -eq "PoweredOn" -and $_.ConnectionState -eq "Connected" } | Sort Name
$encryptionKeys = @()
foreach ($esxiHost in $esxiHosts) {
$esxCli = Get-EsxCli -VMHost $esxiHost -V2
try {
$recoveryKeyList = $esxCli.system.settings.encryption.recovery.list.Invoke()
foreach ($key in $recoveryKeyList) {
$encryptionKeys += [PSCustomObject]@{
HostName = $esxiHost.Name
RecoveryKey = $key.Key
#Description = $key.Description
#CreatedTime = $key.Created
RecoveryID = $key.RecoveryID
}
}
} catch {
Write-Error "Failed to retrieve encryption keys for host $($esxiHost.Name)"
}
}
return $encryptionKeys
}
Original Message:
Sent: Jul 08, 2024 09:56 AM
From: TX_Tundra
Subject: ESXi Host encryption Key
Is it the TPM Encryption keys? Try this. I use the Start-Transcript/Stop-Transcript to output to a text file:
Start-Transcript -Path "C:\temp\tpmkeys.txt"$VMHosts = get-vmhost | Where { $_.PowerState -eq "PoweredOn" -and $_.ConnectionState -eq "Connected" } | Sort Nameforeach ($VMHost in $VMHosts) { $esxcli = Get-EsxCli -VMHost $VMHost try { $key = $esxcli.system.settings.encryption.recovery.list() Write-Host "$VMHost;$($key.RecoveryID);$($key.Key)" } catch { }} Stop-Transcript
Original Message:
Sent: Jul 08, 2024 08:52 AM
From: iDIGIT
Subject: ESXi Host encryption Key
Great as always.
Original Message:
Sent: Jul 05, 2024 11:21 AM
From: LucD
Subject: ESXi Host encryption Key
You can run all esxcli commands via the Get-EsxCli cmdlet.
------------------------------
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Original Message:
Sent: Jul 05, 2024 10:31 AM
From: iDIGIT
Subject: ESXi Host encryption Key
Looking for PowerCLI script to list encryption key (the same output by "esxcli system settings encryption recovery list") for all ESXi hosts in a vCenter.
Thanks,