VMware Cloud Community
sp93
Contributor
Contributor
Jump to solution

How to perform an action using set-vm on multiple VMs

I would like to clear the description field on many VMs at a time. Since there is not current a method to properly clear the VM description field I'm just replacing the description with a "space". The command:

set-vm "name" -description " " -Confirm:$false

works just fine for one VM, however when I try the following:

set-vm -description " " -Confirm:$false

I receive the error "The specified parameter 'VM' expects a single value, but your name criteria 'src *' corresponds to multiple values"

can anyone help?

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You have to tell Set-VM which "VMs" you want this to happen on.

There are 2 ways of specyfying the VMs

1) as a parameter to the Set-VM cmdlet

Set-VM MyPC -Description " "
Set-VM My* -Description " "

2) you can "pipe" one or more VMs to the Set-VM cmdlet

Get-VM | Set-VM -Description " "
Get-VM My* | Set-VM -Description " "

Hope this clarifies it a bit.


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

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You have to tell Set-VM which "VMs" you want this to happen on.

There are 2 ways of specyfying the VMs

1) as a parameter to the Set-VM cmdlet

Set-VM MyPC -Description " "
Set-VM My* -Description " "

2) you can "pipe" one or more VMs to the Set-VM cmdlet

Get-VM | Set-VM -Description " "
Get-VM My* | Set-VM -Description " "

Hope this clarifies it a bit.


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

Reply
0 Kudos
sp93
Contributor
Contributor
Jump to solution

great, thanks. I had tried the first method, however I was getting the error, the pipe method worked perfectly, thanks

Reply
0 Kudos