VMware Cloud Community
sinneh
Contributor
Contributor
Jump to solution

How to use Add-VirtualSwitchPhysicalNetworkAdapter cmdlet?

How to use Add-VirtualSwitchPhysicalNetworkAdapter correctly?

I want to add the network card vmnic1 to vswitch0 in the host in the cluster

1

PS C:\Users\hzwdh\Desktop\Powercli\rumen> Get-VMHost | Get-VirtualSwitch | Select-Object -First 1 |

Get-VMHostNetworkAdapter -Physical -Name vmnic1 |

Add-VirtualSwitchPhysicalNetworkAdapter -VMHostPhysicalNic vmnic1

Add-VirtualSwitchPhysicalNetworkAdapter : 无法绑定参数“VMHostPhysicalNic”。无法将“System.String”类型的“vmn

ic1”值转换为“VMware.VimAutomation.ViCore.Types.V1.Host.Networking.Nic.PhysicalNic”类型。

所在位置 行:3 字符: 60

+ Add-VirtualSwitchPhysicalNetworkAdapter -VMHostPhysicalNic vmnic1

+                                                            ~~~~~~

    + CategoryInfo          : InvalidArgument: (:) [Add-VirtualSwitchPhysicalNetworkAdapter] 

   ,ParameterBindingException

    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.ViCore.Cmd 

   lets.Commands.AddVirtualSwitchPhysicalNetworkAdapte

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can't use a [String] value on the VMHostPhysicalNic parameter, it has to be an object returned by the Get-VMHostNetworkAdapter cmdlet.

Have a look at Example 2 of the Add-VirtualSwitchPhysicalNetworkAdapter cmdlet's help.


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You can't use a [String] value on the VMHostPhysicalNic parameter, it has to be an object returned by the Get-VMHostNetworkAdapter cmdlet.

Have a look at Example 2 of the Add-VirtualSwitchPhysicalNetworkAdapter cmdlet's help.


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

0 Kudos
sinneh
Contributor
Contributor
Jump to solution

thank you very much!

0 Kudos