Hello there. I am working on writing a custom powershell script to get data from a URL and in turn parse it out to get specific values. When I call Invoke-RestMethd the return value is already formated in JSON, how do I get the same out of the below script:
$ErrorActionPreference= 'silentlycontinue'
$url = "http://10.65.4.4:8888/health"
$web = New-Object Net.WebClient
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }
$output = $web.DownloadString($url)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = $null
The return value looks like this:
{"status":"UP","diskSpace":{"status":"UP","free":99706302464,"threshold":10485760},"rabbit":{"status":"UP","version":"3
.5.3"},"db":{"status":"UP","database":"Microsoft SQL Server","hello":1},"configServer":{"status":"UP","propertySources"
:[]}}
It looks like a JSON file but it is not.
NOTE: I have to use the .Net stuff above becuase of SSL cert issues. I am WIDE open to other suggestions.
Thanks in advance.