Do your fellow VMware Admins sometimes forget to fill in the Notes field for a new vm they create? Or would you like to change those inconsistent notes to something more accurate? Todays oneliner simply copies the Active Directory description field into your Virtual Infrastructure. It’s quite blunt about it. Besides asking if you really want to do so, it shows a lot of errors for servers that are powered off or cannot be found in AD. But it pretty much does the trick.
Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer ($_ | Get-View).Guest.HostName.Split(“.”)[0]).Description }
If your vm’s always have the same name as defined in the VM Guest OS, you can suffice with:
Get-VM | ForEach { Set-VM -VM $_ -Description (Get-QADComputer $_.Name).Description }
If you want more advanced description synching, check out the full script.
Enjoy!