Skip to content

Commit

Permalink
Merge pull request #1 from jshbrntt/fix/use-correct-hostvmadapter
Browse files Browse the repository at this point in the history
Use the correct HostVMAdapter
  • Loading branch information
jshbrntt authored Mar 31, 2023
2 parents e162a34 + c913a6b commit 1747397
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builder/hyperv/common/powershell/hyperv/hyperv.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 | Select-Object -First 1
$HostVMAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $switchName | Get-VMNetworkAdapterIsolation | Where-Object { $_.IsolationMode -eq "Vlan" }
if ($HostVMAdapter){
$HostNetAdapter = Get-NetAdapter -IncludeHidden | Where-Object { $_.DeviceId -eq $HostVMAdapter.DeviceId }
if ($HostNetAdapter){
Expand Down

0 comments on commit 1747397

Please sign in to comment.