AndrewG-1234 / PRTG

13 stars 7 forks source link

Doesn't work with new version because of the redirection #1

Closed RomanTi closed 7 years ago

RomanTi commented 8 years ago

Functions don't work on the new version of PRTG (16.2.24.4666) with -MaximumRedirection 0. Works fine if you remove -MaximumRedirection 0 from the module.

PS C:\Users\username> $request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore Invoke-WebRequest : Cannot bind parameter 'Uri'. Cannot convert value "http:///api/setobjectproperty.htm?id=&name=&value=&" to type "System.Uri". Error: "Invalid URI: The hostname could not be parsed." At line:1 char:35

  • $request = Invoke-WebRequest -Uri $url -MaximumRedirection 0 -ErrorAction Ignore
  • 
    - CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    - FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
AndrewG-1234 commented 7 years ago

Your error says "http:///api/setobjectproperty.htm" - this means you have not set the $PRTGHost on line 17.

I cannot install that version, but I have a new version and it works as normal.