Error When Creating External Switches

Nov 5, 2009 at 7:03 AM

I'm creating two external switches on two different NICs with Powershell (I tested this with the latest release as of 11/03/2009).  Here are my lines:

New-VMExternalSwitch -virtualSwitchName "External-1" -ext "Broadcom BCM5708C NetXtreme II GigE (NDIS VBD Client) "
New-VMExternalSwitch -virtualSwitchName "External-2" -ext "Broadcom BCM5708C NetXtreme II GigE (NDIS VBD Client) #2"

The first command executes perfectly, the second throws me an error (which I have appended at the end of this message).

The curious part is that the second switch is indeed created, but it's marked as private - any ideas on how to get around this?

BTW, thanks for this amazing effort, I'll write a complete post on my blog and send you the URL shortly.

New-VMExternalSwitch -virtualSwitchName "External-2" -ext "Broadcom BCM5708C NetXtreme II GigE (NDIS VBD Client) #2"

Name                           Learnable Status                                                                                                                           
                               Addresses                                                                                                                                  
----                           --------- ------                                                                                                                           
External-1                     1024      {OK}                                                                                                                             
Test-wmiResult : Failed to create the external Switch External-2 on Server .<INSTANCE CLASSNAME="Msvm_Error"><PROPERTY NAME="CIMStatusCode" TYPE="uint32"><VALUE>1</VALUE><
/PROPERTY><PROPERTY NAME="CIMStatusCodeDescription" PROPAGATED="true" TYPE="string"></PROPERTY><PROPERTY NAME="ErrorSource" PROPAGATED="true" TYPE="string"></PROPERTY><PRO
PERTY NAME="ErrorSourceFormat" TYPE="uint16"><VALUE>0</VALUE></PROPERTY><PROPERTY NAME="ErrorType" TYPE="uint16"><VALUE>4</VALUE></PROPERTY><PROPERTY NAME="Message" TYPE="
string"><VALUE>Switch set up failed, name='External-2', external port='External-2_ExternalPort', internal port='External-2_InternalPort', NIC='{82E27A68-32F7-4F79-A320-C62
1644D7B59}', internal name='External-2', internal friendly name='External-2', error=2147749896, mof code=0.</VALUE></PROPERTY><PROPERTY.ARRAY NAME="MessageArguments" TYPE=
"string"><VALUE.ARRAY><VALUE>External-2</VALUE><VALUE>External-2_ExternalPort</VALUE><VALUE>External-2_InternalPort</VALUE><VALUE>{82E27A68-32F7-4F79-A320-C621644D7B59}</V
ALUE><VALUE>External-2</VALUE><VALUE>External-2</VALUE><VALUE>2147749896</VALUE><VALUE>0</VALUE></VALUE.ARRAY></PROPERTY.ARRAY><PROPERTY NAME="MessageID" TYPE="string"><VA
LUE>14070</VALUE></PROPERTY><PROPERTY NAME="OtherErrorSourceFormat" PROPAGATED="true" TYPE="string"></PROPERTY><PROPERTY NAME="OtherErrorType" PROPAGATED="true" TYPE="stri
ng"></PROPERTY><PROPERTY NAME="OwningEntity" TYPE="string"><VALUE>Microsoft-Windows-Hyper-V-Network</VALUE></PROPERTY><PROPERTY NAME="PerceivedSeverity" TYPE="uint16"><VAL
UE>3</VALUE></PROPERTY><PROPERTY NAME="ProbableCause" TYPE="uint16"><VALUE>0</VALUE></PROPERTY><PROPERTY NAME="ProbableCauseDescription" PROPAGATED="true" TYPE="string"></
PROPERTY><PROPERTY.ARRAY NAME="RecommendedActions" PROPAGATED="true" TYPE="string"></PROPERTY.ARRAY></INSTANCE>
At C:\Program Files\modules\HyperV\Network.ps1:181 char:54
+                        if ( ($result | Test-wmiResult <<<<  -wait -JobWaitText ($lstr_ExternalSwitchSetup  -f $virtualSwitchName) `
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Test-wmiResult

 

Coordinator
Nov 12, 2009 at 4:16 PM

Try the following command

PS C:\> Get-WmiObject -Namespace $HyperVNamespace -query "Select * from Msvm_ExternalEthernetPort " | select name, isbound

This will give you a list of the NIC names and their status (isbound = linked to a switch).

My hunch is you're seeing a name in one part of the UI which Hyperv does not like .

If the name looks right then try

Get-WmiObject -computername $server -NameSpace  $HyperVNamespace  -query "Select * from Msvm_ExternalEthernetPort where Name like 'XXX_your_nic_name_XXX%' "

If that doesn't get a nic then try putting a \ in front of the # - if that fixes it then I need to put something in the code to test for that.

 

 

 

 

 

 

Jul 20, 2010 at 4:42 AM

My apologies for getting back until now.

Well, I just had to update the system and tried with the latest release of the PS Management Lib and it works like a charm.  

Thanks much for your efforts with this, I've told everyone I can think of about this amazing library, cheers!