VMware Cloud Community
Morodin71
Contributor
Contributor
Jump to solution

set-virtualswitch confirm problem

Hi,

to initialize a new host we would like to bundle a few NICs to a virtual switch. In our script, we do

$vs = Get-VirtualSwitch -vmhost $vhost -name "vSwitch1"
set-virtualswitch -virtualswitch $vs -nic "vmnic2","vmnic3"

which works as intended. However, we always get a question (sorry about the german in the last line):

Perform operation?
Perform operation 'Configuring virtual switch.' on virtual switch 'vSwitch1'
[J] Ja  [A] Ja, alle  [N] Nein  [K] Nein, keine  [H] Anhalten  [?] Hilfe (Standard ist "J"):

As far as we understand the documenation and all examples found, this should not happen. Do you have an idea on how to suppress this question?

Thanks in advance,

Morodin

Reply
0 Kudos
1 Solution

Accepted Solutions
mattboren
Expert
Expert
Jump to solution

Greetings, @Morodin71-

The Set-VirtualSwitch cmdlet (like many cmdlets) has the -Confirm parameter that can be used to add/remove this confirming question.  So, the line would then become:

Set-VirtualSwitch -VirtualSwitch $vs -Nic "vmnic2","vmnic3" -Confirm:$false

Enjoy

View solution in original post

Reply
0 Kudos
3 Replies
mattboren
Expert
Expert
Jump to solution

Greetings, @Morodin71-

The Set-VirtualSwitch cmdlet (like many cmdlets) has the -Confirm parameter that can be used to add/remove this confirming question.  So, the line would then become:

Set-VirtualSwitch -VirtualSwitch $vs -Nic "vmnic2","vmnic3" -Confirm:$false

Enjoy

Reply
0 Kudos
Morodin71
Contributor
Contributor
Jump to solution

I feel actually quite stupid Smiley Sad

I tried the Confirm parameter, but used the wrong syntax, so that the parameter had no effect on the cmdlet.

Thanks for bringing me back on the right track Smiley Happy

Reply
0 Kudos
mattboren
Expert
Expert
Jump to solution

Oh, do not feel stupid -- sometimes we miss things.

Glad to help    

Reply
0 Kudos