I am trying to connect to historic data via this URL, which contains my custom date range (last 30 days) and creds.
$prtgurl = "$PRTGHost/api/historicdata.csv?id=$SensorID&avg=3600&sdate=$StartDate2&edate=$EndDate2&$cred" $request = Invoke-WebRequest -Uri $prtgurl -MaximumRedirection 0 -ErrorAction Ignore
I always get this error, which I cant get past. Any suggestions would be great.
Invoke-WebRequest : Unauthorized + ... $request = Invoke-WebRequest -Uri $prtgurl -MaximumRedirection 0 -Er ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Add comment