VMware Cloud Community
NikhilPathak
Enthusiast
Enthusiast
Jump to solution

Add multiple network Adapters to a VM.

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

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
6 Replies
LucD
Leadership
Leadership
Jump to solution

See New-NetworkAdapter.

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


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

Reply
0 Kudos
NikhilPathak
Enthusiast
Enthusiast
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
NikhilPathak
Enthusiast
Enthusiast
Jump to solution

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.

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

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

Reply
0 Kudos