Can you check if the following already lists the problematic VMs, at least for the powered on VMs.
You should check those where the LogFiles column shows 0.
This would avoid having to do an actual dir of the VM's folder.
Get-View -ViewType VirtualMachine -Property Name,Config.Flags,Config.Files.LogDirectory,Layout.LogFile,Runtime.PowerState |
where{$_.Config.Flags.enableLogging -eq $true} | %{
$_ | Select Name,
@{N='PowerState';E={$_.Runtime.PowerState}},
@{N='LogDirectory';E={$_.Config.Files.LogDirectory}},
@{N='LogFiles';E={$_.Layout.LogFile.Count}}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference