Last active
January 27, 2021 02:37
-
-
Save mikebridge/b77dc6c14c47d5d717bc3655bb46f397 to your computer and use it in GitHub Desktop.
Get the running ngrok host name via PowerShell
This file contains hidden or 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
function Get-NGrokHostName | |
{ | |
Param( | |
[Parameter(Mandatory = $True)][String]$TunnelName | |
) | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | |
$response = Invoke-WebRequest 'http://127.0.0.1:4040/api/tunnels' | |
$obj = $response.Content | ConvertFrom-Json | |
$url = $obj.tunnels | | |
Where-Object { $_.name -eq $TunnelName } | | |
Select-Object -First 1 | | |
Select-Object -ExpandProperty "public_url" | |
return $url | |
} | |
Export-ModuleMember -Function Get-NGrokHostName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Powershell version of this: