Automation

 View Only
  • 1.  New-NetworkAdapter- Unable to create a nic for Win 2016 OS

    Posted Dec 07, 2018 08:36 PM

    Hi all,

    Am trying to create a network adapter on two dummy vms with OS versions marked as  Win2008(vm name = vm1)  and win 2016( vm name = test), using the below command.

    1) PowerCLI F:\> Get-VM test | New-NetworkAdapter -NetworkName xxxxvlan105 -WakeOnLan -StartConnected -Type Vmxnet3

         New-NetworkAdapter : 12/7/2018 8:31:09 PM    New-NetworkAdapter        The network "xxxxvlan105" doesn't exist on the host.

              At line:1 char:15

              + Get-VM test | New-NetworkAdapter -NetworkName xxxxvlan105 -WakeOnLan -StartConne ...

            + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

             + CategoryInfo          : ResourceUnavailable: (xxxxvlan105:String) [New-NetworkAdapter], ViError

             + FullyQualifiedErrorId : Client20_VmHostServiceImpl_TryGetHostNetworkByName_NonexistentNetwork,VMware.VimAutomation.ViCore.Cmdlets.Commands.Vir

            tualDevice.NewNetworkAdapter

    2) PowerCLI F:\> Get-VM vm1 | New-NetworkAdapter -NetworkName xxxxvlan105 -WakeOnLan -StartConnected -Type Vmxnet3

    Name                 Type       NetworkName  MacAddress         WakeOnLan

                                                                      Enabled

    ----                 ----       -----------  ----------         ---------

    Network adapter 6    Vmxnet3    xxxxvlan105  00:50:56:94:xx:xx       True

    Note:

    If I change the OS version to 2008 on vm "test", then am able to create the network adapter.

    Any suggestions please...



  • 2.  RE: New-NetworkAdapter- Unable to create a nic for Win 2016 OS

    Posted Dec 08, 2018 12:12 AM

    Are you sure that portgroup exists?



  • 3.  RE: New-NetworkAdapter- Unable to create a nic for Win 2016 OS

    Posted Dec 11, 2018 09:10 PM

    Hi LucD,

    Yes, the portgroup exists.

    I created two vms, one will OS 2008 and other with 2016 on the same host.

    This command works for 2008 OS tagged vm but not on 2016 OS.

    Infact, if I change the OS version to 2008 in edit settings ( from 2016), this command works fine.



  • 4.  RE: New-NetworkAdapter- Unable to create a nic for Win 2016 OS

    Posted Dec 11, 2018 09:15 PM

    Is this perhaps a portgroup on a VSS?
    In that case it needs to be defined on the ESXi node where the VM is registered to.
    You can check with (update the name of the VM and the portgroup accordingly)

    Get-VM -Name vm1 | Get-VMHost | Get-VirtualPortGroup -Name xxxxvlan105