Select first adapter attached to host OS's switch
If more than one vNic is attached to vmSwitch, use the first one only.
This commit is contained in:
parent
6a85855c81
commit
d6994df188
|
@ -32,7 +32,7 @@ type scriptOptions struct {
|
|||
func GetHostAdapterIpAddressForSwitch(switchName string) (string, error) {
|
||||
var script = `
|
||||
param([string]$switchName, [int]$addressIndex)
|
||||
$HostVMAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $switchName
|
||||
$HostVMAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $switchName | Select-Object -First 1
|
||||
if ($HostVMAdapter){
|
||||
$HostNetAdapter = Get-NetAdapter | Where-Object { $_.DeviceId -eq $HostVMAdapter.DeviceId }
|
||||
if ($HostNetAdapter){
|
||||
|
|
Loading…
Reference in New Issue