Search code examples
powershellvmwarepowercli

Query VMHost lockdown status


I am creating and new audit script for our VMware hosts. One of the paramiters is to check the "Lockdown Mode" status. I came up with the following line but it seems more of a hack. Is their a more elegant way to query the Lockdown Mode on a host?

#hostname
$vmh = host

$status = (Get-view (Get-VMHost $vmh | Get-view).ConfigManager.HostAccessManager).LockdownMode

write-host $status

Solution

  • Give this a go:

    (Get-VMHost -Name $vmh).ExtensionData.Config.LockdownMode