|
|
| (Une version intermédiaire par le même utilisateur non affichée) |
| Ligne 25 : |
Ligne 25 : |
|
| |
|
| === Script === | | === Script === |
| <source>
| | Voir l'article [[Speedtest]]. |
| $DateLog = Get-Date -Format "dd/MM/yyyy HH:mm K"
| |
| $datePrefix = Get-Date -Format "yyyyMM_"
| |
| $DownloadLocation = "C:\Support"
| |
| $SpeedTestTxt = $DownloadLocation + "\" + $datePrefix + "speedtest_history.txt"
| |
| | |
| $SpeedtestResults = &"$DownloadLocation\speedtest.exe" --format=json --accept-license --accept-gdpr
| |
| $SpeedtestResults = $SpeedtestResults | ConvertFrom-Json
| |
| | |
| [PSCustomObject]$SpeedtestObj = @{
| |
| downloadspeed = [math]::Round($SpeedtestResults.download.bandwidth / 1000000 * 8, 2)
| |
| uploadspeed = [math]::Round($SpeedtestResults.upload.bandwidth / 1000000 * 8, 2)
| |
| packetloss = [math]::Round($SpeedtestResults.packetLoss)
| |
| isp = $SpeedtestResults.isp
| |
| ExternalIP = $SpeedtestResults.interface.externalIp
| |
| InternalIP = $SpeedtestResults.interface.internalIp
| |
| UsedServer = $SpeedtestResults.server.host
| |
| ResultsURL = $SpeedtestResults.result.url
| |
| Jitter = [math]::Round($SpeedtestResults.ping.jitter)
| |
| Latency = [math]::Round($SpeedtestResults.ping.latency)
| |
| }
| |
| | |
| $PublicIP = $SpeedtestObj.ExternalIP
| |
| $SpeedTestResultDownload = $SpeedtestObj.downloadspeed
| |
| $SpeedTestResultDownload = "{0:#,##0.00;(#,##0.00);ERREUR}" -f $SpeedTestResultDownload
| |
| $SpeedTestResultUpload = $SpeedtestObj.uploadspeed
| |
| $SpeedTestResultUpload = "{0:#,##0.00;(#,##0.00);ERREUR}" -f $SpeedTestResultUpload
| |
| $SpeedTestResultLatency = $SpeedtestObj.Latency
| |
| $SpeedTestResultLossPk = ($SpeedtestObj.packetloss).tostring("P")
| |
| $SpeedTestResultISP = $SpeedtestObj.isp
| |
| $SpeedTestResultServer = $SpeedtestObj.UsedServer
| |
| $SpeedTestResultServerId = $SpeedtestResults.server.id
| |
| $SpeedTestResultServerId1 = "{0:00000}" -f $SpeedTestResultServerId
| |
| $SpeedTestResultServerLocation = $SpeedtestResults.server.location
| |
| | |
| "$DateLog`t DL: $SpeedTestResultDownload`tMbps UL: $SpeedTestResultUpload`tMbps PING: $SpeedTestResultLatency`tms LOSS: $SpeedTestResultLossPk ISP: $PublicIP ($SpeedTestResultISP) SERVER: $SpeedTestResultServerLocation ; id = $SpeedTestResultServerId1 ($SpeedTestResultServer)" | Out-File -Append -Encoding ascii -FilePath $SpeedTestTxt
| |
| </source>
| |
|
| |
|
| == Voir aussi == | | == Voir aussi == |