diff --git a/public/Install-DbaMaintenanceSolution.ps1 b/public/Install-DbaMaintenanceSolution.ps1 index efd9dafe5b..cded18dca9 100644 --- a/public/Install-DbaMaintenanceSolution.ps1 +++ b/public/Install-DbaMaintenanceSolution.ps1 @@ -234,16 +234,18 @@ function Install-DbaMaintenanceSolution { Write-ProgressHelper -ExcludePercent -Message "If Ola Hallengren's scripts are found, we will drop and recreate them" } + # does this machine have internet access to download the files if required? if (-not $isLinux -and -not $isMacOs) { if ((Get-Command -Name Get-NetConnectionProfile -ErrorAction SilentlyContinue)) { - $script:internet = (Get-NetConnectionProfile).IPv4Connectivity -contains "Internet" + $script:internet = (Get-NetConnectionProfile -ErrorAction SilentlyContinue).IPv4Connectivity -contains "Internet" } else { try { $network = [Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}") $script:internet = ([Activator]::CreateInstance($network)).GetNetworkConnections() | ForEach-Object { $_.GetNetwork().GetConnectivity() } | Where-Object { ($_ -band 64) -eq 64 } } catch { - # don't care + # probably a container with internet + $script:internet = $true } }