#Connect to the HP_BIOSSetting WMI class
$HPBiosSettings = Get-WmiObject -Namespace root/hp/InstrumentedBIOS -Class HP_BIOSSetting
#Check the status of the setup password
($HPBiosSettings | Where-Object Name -eq "Setup Password").IsSet
#Check the status of the power-On password
($HPBiosSettings | Where-Object Name -eq "Power-On Password").IsSet