Private/Resolve-PrismServerName.ps1

function Resolve-PrismServerName {
    [CmdletBinding()]
    [OutputType([string])]
    param(
        [Parameter(Mandatory)][ValidateNotNullOrEmpty()][string]$Server
    )

    $serverAddress = $Server.Trim()
    if ($serverAddress -notmatch '^[a-z][a-z0-9+.-]*://') {
        $serverAddress = 'https://' + $serverAddress
    }

    $serverUri = $null
    if (-not [uri]::TryCreate($serverAddress, [UriKind]::Absolute, [ref]$serverUri) -or
        $serverUri.Scheme -notin @('http', 'https') -or
        [string]::IsNullOrEmpty($serverUri.Host)) {
        throw "Invalid Prism server '$Server'. Specify a hostname, IP address, or HTTP/HTTPS URL."
    }

    return $serverUri.Host.ToLowerInvariant()
}