If I understand the thread correctly you want to be able to find guests that are powered on but where the OS is not running since it's not installed ?
The following simple script will create a CSV file which reports on different types of states of all your guests.
$report = @()
Get-View -ViewType VirtualMachine | %{
$row = "" | Select VMname, PowerState, ToolsStatus, GuestHeartbeatStatus
$row.VMname = $_.Name
$row.PowerState = $_.Summary.Runtime.PowerState
$row.ToolsStatus = $_.Guest.ToolsStatus
$row.GuestHeartbeatStatus = $_.GuestHeartbeatStatus
$report += $row
}
$report | Export-Csv "C:\VM-States.csv"
If you look in the CSV and select the guests which have a powerstate of "poweredon" and a GuestHeartbeatStatus of "red" you will have found the guests you were looking for.
If you want a script that reports only those guests, an if statements in the previous script will do the trick.
$report = @()
Get-View -ViewType VirtualMachine | %{
$row = "" | Select VMname, PowerState, ToolsStatus, GuestHeartbeatStatus
$row.VMname = $_.Name
$row.PowerState = $_.Summary.Runtime.PowerState
$row.ToolsStatus = $_.Guest.ToolsStatus
$row.GuestHeartbeatStatus = $_.GuestHeartbeatStatus
if($row.PowerState -eq "poweredon" -and $row.GuestHeartbeatStatus -eq "red"){
$report += $row
}
}
$report | Export-Csv "C:\VM-States.csv"
I hope this is what you're looking for ?