GrantOrchardVMw
Commander
Commander

New-VirtualSwitch not working with variables for -nic

Hey guys,

Running into an issue here. When I run

Get-VMHost $VMHost1 | New-VirtualSwitch -Name vSwitch1 -Nic vmnic8,vmnic4

Everything works fine. However, when I run

$vSwitch1NIC1 = "vmnic8"
$vSwitch1NIC2 = "vmnic4"

Get-VMHost $VMHost1 | New-VirtualSwitch -Name vSwitch1 -Nic $vSwitch1NIC1,$vSwitch1NIC2

nothing happens at all.

Am I missing something here?

Thanks in advance,

Grant

Grant http://grantorchard.com
0 Kudos
4 Replies
LucD
Leadership
Leadership

Both versions work perfectly for me.

Which PowerCLI build are you using ?

Get-PowerCLIVersion

If it doesn't say


PowerCLI Version
----------------
   VMware vSphere PowerCLI 4.1 U1 build 332441

you should perhaps consider upgrading.


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

0 Kudos
GrantOrchardVMw
Commander
Commander

Yep, that's my build number.

vCenter version is 4.1 258902 and ESXi is 4.1 260247

Very strange.

Grant http://grantorchard.com
0 Kudos
LucD
Leadership
Leadership

And you don't get any message whatsoever ?

From where do you run this ? From the PowerCLI prompt ? Or from a GUI ?


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

0 Kudos
GrantOrchardVMw
Commander
Commander

I was running it from the PowerCLI prompt, and there was no message whatsoever.... yet strangely trying it again 10 minutes later it has worked. I guess the most likely culprit is a typo.

Thanks for your assistance in any case.

Grant

Grant http://grantorchard.com
0 Kudos