Today I found myself needing to find all hosts that were in a state other than connected within a datacenter. It’s only a one-liner and I’m sure you can (or have) found it elsewhere, but here it is again for reference:
Get-Datacenter -Name "ProfessionalVMware" | Get-VMHost | Where { $_.State -ne "Connected" } | Select Name
Breaking down the pipeline is simple enough. First we get a specific datacenter (Get-Datacenter -Name “”). Next we get a list of all ESX(i) hosts and select the ones that are not “Connected” (Get-VMHost | Where {…). Finally we select the names. Mind, sample output is missing as at this stage everything in the home lab is connected. Sorry!