Hi All, I am trying to get the above custom script to work and am having some problems. Hope you can help. I have configured the sensor to use the custom Get-DFSRBacklog.ps1 script but I am receiving:
XML: Structural error in xml file, 1 open items. -- JSON: The returned json does not match the expected structure (Invalid JSON.). (code: PE231)
I have saved the result to disk and am getting:
Get-WmiObject : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESS DENIED)) At C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\Get-DFSRBa cklog.ps1:99 char:32 + $Namespaces = Get-WmiObject <<<< -class __Namespace -namespace root -com putername $computer | Where {$_.name -eq $namespace} + CategoryInfo : NotSpecified: (:) [Get-WmiObject], UnauthorizedA ccessException + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.Pow erShell.Commands.GetWmiObjectCommand C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\Get-DFSRBackl og.ps1 : MicrosoftDFS WMI Namespace does not exist on 'COMPUTERNAME'. Run locally on a system with the Namespace, or provide computer parameter of that system to ru n remotely. At line:1 char:2 + & <<<< 'C:\Program Files (x86)\PRTG Network Monitor\custom sensors\EXEXML\Get -DFSRBacklog.ps1' -computer COMPUTERNAME; exit $LASTEXITCODE + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep tion + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio n,Get-DFSRBacklog.ps1
(nb I have replaced the real computername with COMPUTERNAME above)
Reading up I have found that passing credentials may not work running this script so I have entered credentials in manually to the script but still receive the same errors.
The script works if I run it from the computer the PRTG probe is installed on, it JUST doesn't work when executed by PRTG.
Any help greatly appreciated.
Add comment