Hello, I'm trying to fix a truncated output for a scenario where the expandProperty does not work. I searched in google but haven't found a solution to this:
foreach ($vmi in $vmNames){
Get-VM $vmi | ?{$_.Name -notlike "*CTX*" -and $_.Name -notlike "*CX*"} | Select-Object `
@{N="Name";E={$vmi | Select -ExpandProperty Name}},
@{N="Tools-Status";E={
if($_.Guest.Extensiondata.GuestState -eq "notRunning"){
"Not running"}
else{
$_.Guest.Extensiondata.ToolsVersionStatus.Replace("guestToolsNeedUpgrade","Out of date").Replace("guestToolsNotInstalled","Not installed").Replace("guestToolsCurrent","OK").Replace("guestToolsUnmanaged","Unmanaged")
}
}}
}
The name of certain VMs is truncated. I don't want the -ft because it's not useful to read for what I'm doing... I hope someone has a fix many thanks!