VMware Cloud Community
grinty
Contributor
Contributor
Jump to solution

How to clear the VM descripton field?

Hello,

I would like to clear the description field of a VM. I use the command set-vm <vmname> -description "". The task finished successfully in the powershell console and in the VC, but nothing happens. What means the description field text is not changed. If I use the command (set-vm <vmname> -description "Hello World") to fill the description field, it works. Anyone a idea how to clear the description field?

Thanks

Markus

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That option seems to be absent.

Until it is fixed you can use this script that uses the ReconfigVM method.

$vm = Get-VM -Name <VM-name> | Get-View

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.annotation = ""
$vm.ReconfigVM($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

That option seems to be absent.

Until it is fixed you can use this script that uses the ReconfigVM method.

$vm = Get-VM -Name <VM-name> | Get-View

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.annotation = ""
$vm.ReconfigVM($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

I can confirm this to be a minor bug. Setting it to " " (a space) will work. I'm sure there's a way to do it with the SDK but I don't have time to look for the right object right now. I tried this but the change did not take effect. I'm sure LucD can explain why not. Smiley Happy

$vmview = get-vm foo | get-view
$vmview.Config.Annotation = $null

@VMware--make the Description parameter nullable please...






Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos
halr9000
Commander
Commander
Jump to solution

I should've hit reload. Smiley Happy

Author of the upcoming book: Managing VMware Infrastructure with PowerShell

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
Reply
0 Kudos