Enable Check-PSGalleryApiAvailability on Linux
Updating Enable Check-PSGalleryApiAvailability on Linux to use [System.Net.NetworkInformation.NetworkInterface]::GetIsNetworkAvailable()
This commit is contained in:
parent
258fd792fc
commit
7c32155421
|
@ -6040,10 +6040,15 @@ function Check-PSGalleryApiAvailability
|
||||||
{
|
{
|
||||||
$connected = Microsoft.PowerShell.Management\Test-Connection -ComputerName $microsoftDomain -Count 1 -Quiet
|
$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
|
$connected = NetTCPIP\Test-NetConnection -ComputerName $microsoftDomain -InformationLevel Quiet
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$connected = [System.Net.NetworkInformation.NetworkInterface]::GetIsNetworkAvailable()
|
||||||
|
}
|
||||||
|
|
||||||
if ( -not $connected)
|
if ( -not $connected)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue