Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 1.04 KB
function Get-SpeedTestConfig {
<#
.SYNOPSIS
Get the default server configurations for Internet and Local speed test servers.
.DESCRIPTION
Get the default server configurations for Internet and Local speed test servers.
.EXAMPLE
Get-SpeedTestConfig
#>
[CmdletBinding()]
Param()
try {
Write-Verbose -Message 'Getting content of config.json and returning as a PSCustomObject.'
$config = Get-Content -Path "$PSScriptRoot\config.json" -ErrorAction 'Stop' | ConvertFrom-Json
$config = [PSCustomObject] @{
DefaultInternetServer = $config.defaultInternetServer.defaultServer;
DefaultInternetPort = $config.defaultInternetServer.defaultPort;
DefaultLocalServer = $config.defaultLocalServer.defaultServer;
DefaultLocalPort = $config.defaultLocalServer.defaultPort;
}
return $config
} catch {
throw "Can't find the JSON configuration file. Use 'Set-SpeedTestConfig' to create one."
}
}
You can’t perform that action at this time.