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
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
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
thank you very much!