Try this line if you would like to know whether a machine is currently connected to the Internet:
[Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]'{DCB00C01-570F-4A9B-8D69-199FDBA5723B}')).IsConnectedToInternet
It returns $true when there is an Internet connection available.