SNIP | VMware - VM - Take the 'Owner' and 'Application' custom attributes and write them to the 'Notes' field
$MigrationVMs |sort Name | %{
$vm = $_
$owner = ($vm |select CustomFields -first 1 -ExpandProperty CustomFields |select Key,Value | ? Key -eq "Owner").value
$application = ($vm |select CustomFields -first 1 -ExpandProperty CustomFields |select Key,Value | ? Key -eq "Application").value
$NewNotes = $owner, $application -join " | "
if ($NewNotes -ne " | ") {
$temp = "" | Select VMName, Notes
$temp.VMName = $vm
$temp.Notes = $NewNotes
$temp
$null = set-vm $vm -notes $NewNotes -Confirm:$false -RunAsync
}
} | ft -auto