From 372b3b6d80ef5ede742961bca44d726d16249646 Mon Sep 17 00:00:00 2001 From: Dafydd Jones Date: Tue, 9 Jun 2020 02:00:07 +0100 Subject: [PATCH] fix(tap-adapter.ps1): work with alternate name `Local Area Connection` * the `tapinstall.exe` command creates adapters with the generic names of either `Ethernet x` or `Local Area Connection x`. --- openvpn/files/tap-adapter.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvpn/files/tap-adapter.ps1 b/openvpn/files/tap-adapter.ps1 index e9a91c2..eb9ce62 100644 --- a/openvpn/files/tap-adapter.ps1 +++ b/openvpn/files/tap-adapter.ps1 @@ -12,10 +12,10 @@ if ($PSCmdlet.ParameterSetName -eq 'new') { Write-Host "changed=no comment=`'TAP-Windows adapter $New exists`'" exit } - if (-Not (Get-NetAdapter -InterfaceDescription $tapDesc | Where-Object Name -Like Eth*)) { + if (-Not (Get-NetAdapter -InterfaceDescription $tapDesc | Where-Object Name -Match "^(Ethernet|Local Area Connection)")) { $p = Start-Process $tapInstallCmd -ArgumentList $tapInstallArgs -NoNewWindow -Wait -PassThru } - Get-NetAdapter -InterfaceDescription $tapDesc | Where-Object Name -Like Eth* ` + Get-NetAdapter -InterfaceDescription $tapDesc | Where-Object Name -Match "^(Ethernet|Local Area Connection)" ` | Select-Object -First 1 | Rename-NetAdapter -NewName $New Write-Host "changed=yes comment=`'TAP-Windows adapter $New created`'" }