Automation

 View Only
  • 1.  How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Nov 16, 2012 04:58 PM

    Hello,

    I have been attempting to figure out how to added a E1000E NIC to a Windows Server 2012 VM and have been wildly unsuccessful. None of the current 5.1 PowerCLI documentation even references it's existence.  When I use the Get-NetworkAdapter it returns the E1000E NICs as "Unknown."  I tried adding a NIC with a -Type of "Unknown" and it just added a regular "VMXNET" NIC.

    I am testing against 5.0.0(Build 821926) hosts which can deploy Server 2012 with E1000E NICs via vCenter and PowerCLI 5.0.1 & 5.1 with the same results.  Any information you could provide me with would be greatly appreciated as I am out of ideas at the moment.

    Cheers!



  • 2.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Nov 16, 2012 05:08 PM

    The E1000E is not yet in the enumeration for the VirtualNetworkAdapterType, that exlains why the New-NetworkAdapter doesn't accept the type.

    But in the SDK API you can use the VirtualE1000e type for a NIC.

    With the ReconfigVM_Task method you will be able to add such a NIC type.

    Let me know if you need some sample code ?



  • 3.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Nov 16, 2012 05:11 PM

    Sample code would be great! Thanks Luc you never let me down.



  • 4.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Nov 16, 2012 05:29 PM

    Try something like this

    $vmName = "MyVM"
    $networkName = "networkname"
    $vm
    = Get-VM -Name $vmName $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $dev
    = New-Object VMware.Vim.VirtualDeviceConfigSpec
    $dev
    .Operation = "add"
    $dev.Device = New-Object VMware.Vim.VirtualE1000e
    $dev.Device.Connectable = New-Object VMware.Vim.VirtualDeviceConnectInfo
    $dev.Device.Connectable.StartConnected = $true
    $dev.Device.Backing = New-Object VMware.Vim.VirtualEthernetCardNetworkBackingInfo
    $dev.Device.Backing.DeviceName = $networkName
    $spec.deviceChange += $dev
    $vm
    .ExtensionData.ReconfigVM($spec)


  • 5.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Nov 16, 2012 06:14 PM

    Luc,

    This code helped me get the nic added, I did find a "0" in the StartConnected line which I fixed below. They only thing I noticed is that it's not connecting it to my DVS.  I can get around this using the Set-NetworkAdapter cmdlet but I figure you probably know a way to incorporate it into the code below.  Thanks again!

    LucD wrote:

    Try something like this

    $vmName = "MyVM"
    $networkName = "networkname"
    $vm
    = Get-VM -Name $vmName $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $dev
    = New-Object VMware.Vim.VirtualDeviceConfigSpec
    $dev
    .Operation = "add"
    $dev.Device = New-Object VMware.Vim.VirtualE1000e
    $dev.Device.Connectable = New-Object VMware.Vim.VirtualDeviceConnectInfo
    $dev.Device.Connectable.StartConnected = $true
    $dev.Device.Backing = New-Object VMware.Vim.VirtualEthernetCardNetworkBackingInfo
    $dev.Device.Backing.DeviceName = $networkName
    $spec.deviceChange += $dev
    $vm
    .ExtensionData.ReconfigVM($spec)


  • 6.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Nov 16, 2012 06:23 PM

    That was an uppercase o, but thanks for noticing. I updated the code above.

    I'm preparing a blog post with a function that provides more functionality.

    Hold on



  • 7.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?
    Best Answer

    Posted Nov 16, 2012 09:58 PM

    I just posted Work with E1000E NICs in PowerCLI.

    Give it a try and let me know if it works out for you ?



  • 8.  RE: How do you add a E1000E NIC to Server 2012 VM via PowerCLI?

    Posted Jun 12, 2015 03:48 AM

    I realise this is an old thread but is there a way to edit a network adapter to be an e1000e?