From 7c32155421be785d7aa977aca7d3e51ea1ac10ff Mon Sep 17 00:00:00 2001 From: Manikyam Bavandla Date: Mon, 18 Jul 2016 19:28:02 -0700 Subject: [PATCH] Enable Check-PSGalleryApiAvailability on Linux Updating Enable Check-PSGalleryApiAvailability on Linux to use [System.Net.NetworkInformation.NetworkInterface]::GetIsNetworkAvailable() --- src/Modules/Shared/PowerShellGet/PSModule.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Modules/Shared/PowerShellGet/PSModule.psm1 b/src/Modules/Shared/PowerShellGet/PSModule.psm1 index 4ac5c14d0..d18d966c0 100644 --- a/src/Modules/Shared/PowerShellGet/PSModule.psm1 +++ b/src/Modules/Shared/PowerShellGet/PSModule.psm1 @@ -6040,10 +6040,15 @@ function Check-PSGalleryApiAvailability { $connected = Microsoft.PowerShell.Management\Test-Connection -ComputerName $microsoftDomain -Count 1 -Quiet } - else + elseif(Get-Command NetTCPIP\Test-Connection -ErrorAction Ignore) { $connected = NetTCPIP\Test-NetConnection -ComputerName $microsoftDomain -InformationLevel Quiet } + else + { + $connected = [System.Net.NetworkInformation.NetworkInterface]::GetIsNetworkAvailable() + } + if ( -not $connected) { return