Created
November 11, 2023 13:50
-
-
Save vitordelucca/ee4d858559d63e6eea3de71522a19563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define the domains to ping | |
$domains = @("audio-fa.scdn.co", "v.reddit.com", "i.reddit.com", "cdn.discordapp.com", "media.bolha.us", "s3.c.im", "redditmedia.com", | |
"test.aaplimg.com", "is3-ssl.mzstatic.com", "objects.githubusercontent.com", "public.dm.files.1drv.com", "cdn.jsdelivr.net", "res.cdn.office.net", "cdn.onenote.net","tlu.dl.delivery.mp.microsoft.com", | |
"imap-mail.outlook.com", "g.whatsapp.net", "pps.whatsapp.net", | |
"video.twimg.com", "pbs.twimg.com", "twitter.com", "lh3.googleusercontent.com", | |
"i.ytimg.com", "cdn.akamai.steamstatic.com", "th.bing.com", | |
"cdn-fastly.obsproject.com", "upload.wikimedia.org", "cdn.samsungcloudsolution.com", | |
"cdn-lfs.huggingface.co", "scontent.cdninstagram.com", "conteudo.imguol.com.br", "149.154.175.53", "xgpuwebf2p.gssv-play-prod.xboxlive.com", "qn-01277-spomb-1-02-2.claro-tv-live.qwilted-cds.cqloud.com", "lol.secure.dyn.riotcdn.net", "statics.teams.cdn.live.net", "d3p8zr0ffa9t17.cloudfront.net", "vod-gcs-cedexis.cbsaavideo.com", "downloadr2.apkmirror.com", "drscdn.500px.org", "cdn.funtrivia.com") | |
# Ping each domain and get the average latency | |
$results = foreach ($domain in $domains) { | |
# Use the Test-Connection cmdlet to ping the domain and get the results | |
$pingResults = Test-Connection -ComputerName $domain -Count 2 | |
# Get the lowest latency | |
$avgLatency = ($pingResults | Measure-Object -Property Latency -Minimum).Minimum | |
# Get Address IP | |
$adName = ($pingResults | Select-Object -Property Address -Unique).Address | |
# Create an object to store the results | |
[PSCustomObject]@{ | |
Source = $env:COMPUTERNAME | |
Address = $adName | |
Destination = $domain | |
Status = "Success" | |
Latency = $avgLatency | |
} | |
} | |
# Output the results in a table format | |
$results | Format-Table -Property Source, Address, Destination, Latency, Status -AutoSize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment