Automation

 View Only
  • 1.  Set-NetworkAdapter bug?

    Broadcom Employee
    Posted Sep 12, 2012 09:59 AM

    Hi,

    I am trying to use the set-networkadpater cmdlet to change the network portgroup of a VM from VDS to VSS, both portgroups have the same name.

    E.g.

    Type     SwitchName     PortgroupName

    VSS      vSwitch0           VM Network

    VDS      dvSwitch0         VM Network

    Get-VM -name "test2vm" | Get-NetworkAdapter | Set-NetworkAdapter -networkname "VM Network"

    Everything goes through successfully, but the connection default to the "VM Network" on the dvSwitch0. Is this a bug?

    Or did I miss anything here?



  • 2.  RE: Set-NetworkAdapter bug?

    Posted Sep 12, 2012 10:56 AM

    Did you try adding the DistributedSwitch parameter ?

    Something like this

    Get-VM -name "test2vm" | Get-NetworkAdapter | Set-NetworkAdapter -networkname "VM Network" -DistributedSwitch VDS



  • 3.  RE: Set-NetworkAdapter bug?

    Broadcom Employee
    Posted Sep 12, 2012 12:17 PM

    Yes, tried that as well, but giving error. I suppose it is expecting a distributed switch, not a standard switch.



  • 4.  RE: Set-NetworkAdapter bug?

    Posted Sep 12, 2012 12:23 PM

    You can try to temporarily rename to portgroup name on the standard switch to a unique name. Then change the networkadapter. And finally rename the portgroup name back to its original name.



  • 5.  RE: Set-NetworkAdapter bug?

    Broadcom Employee
    Posted Sep 12, 2012 12:52 PM

    That sounds like a good workaround. However, I think fundamentally there is some issue with the cmdlet. It would be good if it can take in a portgroup as an object, rather than a string name.



  • 6.  RE: Set-NetworkAdapter bug?

    Posted Sep 12, 2012 03:11 PM

    Agreed on that.

    You can also try my function from dvSwitch scripting – Part 8 – Get and Set network adapters



  • 7.  RE: Set-NetworkAdapter bug?

    Broadcom Employee
    Posted Sep 13, 2012 02:37 AM

    Thank LucD, great stuff on your blog.

    I have tried it, the behaviour I am seeing is that when the same portgroup name is found on VDS and VSS, no changes is made on the VM portgroup connection.