From d67158b17171a51094ca70c686efa5ac2e94b531 Mon Sep 17 00:00:00 2001 From: djpbessems Date: Fri, 19 Feb 2021 21:16:30 +0100 Subject: [PATCH] Fix loop waiting for network --- scripts/Server2019/payload/Apply-OVFProperties.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Server2019/payload/Apply-OVFProperties.ps1 b/scripts/Server2019/payload/Apply-OVFProperties.ps1 index 9e59b7d..d77653b 100644 --- a/scripts/Server2019/payload/Apply-OVFProperties.ps1 +++ b/scripts/Server2019/payload/Apply-OVFProperties.ps1 @@ -101,7 +101,7 @@ If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotCon PrefixLength = $ovfPropertyValues['guestinfo.prefixlength'] DefaultGateway = $ovfPropertyValues['guestinfo.gateway'] } - New-NetIPAddress @NewNetIPAddressSplat + $IPAddress = New-NetIPAddress @NewNetIPAddressSplat # Wait for network connection to become available $Timestamp, $TimeoutMinutes = (Get-Date), 5 @@ -121,7 +121,8 @@ If ((Get-WmiObject -Class 'Win32_NetworkAdapterConfiguration').IPAddress -NotCon Start-Sleep -Milliseconds 250 $GetNetIPAddressSplat = @{ - InterfaceAlias = (Get-NetAdapter).Name + IPAddress = $ovfPropertyValues['guestinfo.ipaddress'] + InterfaceIndex = $IPAddress.InterfaceIndex AddressFamily = 'IPv4' ErrorAction = 'SilentlyContinue' }