Enthusiast
Enthusiast

Add multiple network Adapters to a VM.

Jump to solution

I am looking for a command to add new Network card to the VM.

0 Kudos
1 Solution

Accepted Solutions
Leadership
Leadership

Yes, the NetworkName parameter is a required parameter.
So you have to provide an existing portgroup.

I normally use a 'dummy' portgroup for that, and only set the final portgroup later on.


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

View solution in original post

0 Kudos
6 Replies
Leadership
Leadership

See New-NetworkAdapter.

You'll have to repeat the cmdlet for multiple vNICs.


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

0 Kudos
Enthusiast
Enthusiast

Hi LUcD,

We did try that, but received the error as

New-NetworkAdapter -VM $vm_details.Name -NetworkName "custom_nw_10.78.215.XX" -Type e1000 -StartConnected -WakeOnLan

New-NetworkAdapter : 6/26/2019 10:59:37 AM New-NetworkAdapter The network "custom_nw_10.78.215.XX" doesn't exist on the host.

At line:1 char:1

+ New-NetworkAdapter -VM $vm_details.Name -NetworkName "custom_nw_10.78 ...

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

    + CategoryInfo          : ResourceUnavailable: (custom_nw_10.78.215.XX:String) [New-NetworkAdapter], ViError

    + FullyQualifiedErrorId : Client20_VmHostServiceImpl_TryGetHostNetworkByName_NonexistentNetwork,VMware.VimAutomation.ViCore.Cmdlets.Commands.VirtualDevice.NewNetworkAdapter

0 Kudos
Leadership
Leadership

It looks as if that portgroup doesn't exist in your environment.

Is that name included in the list when you do a Get-VirtualPortgroup


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

0 Kudos
Enthusiast
Enthusiast

No, it doesnt contain. Do i need to add that first?

The purpose here is to add just a nic 1 wih no network connected.

0 Kudos
Leadership
Leadership

Yes, the NetworkName parameter is a required parameter.
So you have to provide an existing portgroup.

I normally use a 'dummy' portgroup for that, and only set the final portgroup later on.


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

View solution in original post

0 Kudos
Leadership
Leadership

And you can use the StartConnected parameter to make sure the vNic is not connected.

Get-VM -Name MyVM |

New-NetworkAdapter -Type Vmxnet3 -NetworkName Dummy -StartConnected:$false


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

0 Kudos