Hello!
When i import this script in PRTG into "Custom EXE/Script Sensor" i had following error:
Response not well-formed: "(Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configura tion is not complete. Specify the UseBasicParsing parameter and try again. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 30 char:15 + $loginPage = (Invoke-WebRequest -Uri "$url" -SessionVariable PRTG) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupp ortedException + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.Po werShell.Commands.InvokeWebRequestCommand Cannot index into a null array. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 34 char:1 + $LoginForm = $loginPage.Forms[$formId]; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray Cannot index into a null array. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 35 char:1 + $LoginForm.Fields[$usernameId] = $username; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray Cannot index into a null array. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 36 char:1 + $LoginForm.Fields[$passwordId] = $password; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray Cannot index into a null array. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 37 char:1 + $LoginForm.Fields['body_0_content_0_sectioned_0_SignInButton'] = "Sig ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch configura tion is not complete. Specify the UseBasicParsing parameter and try again. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 39 char:12 + $result = (Invoke-WebRequest -Uri ($url) -WebSession $PRTG -Method PO ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) [Invoke-WebRequest], NotSupp ortedException + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.Po werShell.Commands.InvokeWebRequestCommand You cannot call a method on a null-valued expression. At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXE\WebLogin.ps1: 41 char:4 + if($result.Content.Contains($checkString)) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull )" (code: PE132)
What's wrong?
Add comment