$getallvms=(get-vm -ComputerName (Get-ClusterNode))
$result=@()
foreach ($item in $getallvms)
{
$vmname=$item.Name
$vmfullpath=$item.ConfigurationLocation
$vmpathtrim=$vmfullpath.Substring(18)
$pathindex=$vmpathtrim.indexof(“\”)
$csvpathfrom=$vmpathtrim.substring(0,$pathindex)
$properties=@{
Name=$vmname
Path=$csvpathfrom
#Write-Host $item.name
}
$result+=New-Object psobject -Property $properties
}
$result |Sort-Object path