Files
Sandbox/VMware-TPM.ps1
Zack Meier 03dba08135 sync
2026-04-15 15:42:41 -05:00

20 lines
583 B
PowerShell

$Result = [System.Collections.ArrayList]@()
$VMHosts = Get-VMHost
ForEach ($VMHost in $VMHostNames) {
$EsxCli = Get-EsxCli -VMHost $VMHost -V2
$Settings = $EsxCli.system.settings.encryption.get.invoke()
If ($Settings.Mode -eq "TPM") {
$list = $EsxCli.system.settings.encryption.recovery.list.invoke()
$obj = [PSCustomObject]@{
'Name' = $VMHost
'Key' = $list.Key
'RecoveryId' = $list.RecoveryId
}
$null = $Result.Add($obj)
}
else {
$obj = $null
$list = $null
}
}