Hi

I have written powershell script to extract the the information related to sensors like name , id , channel values , priority , interval etc . But I am not finding suitable command to extract the information Script name from relevant sensor . Sensor setting ---> script .

The sensors are in Passelers monitoring tool PRTG . I am extracting data from PRTG server with the help of Powershell script ... but not able to extract data of field called as script ( used to mention script name , used to run in that sensor)

Script Snippet

'Device: ' + $sensor.Device | Out-File -FilePath $outFile -Append 'Type: ' + $sensor.Type | Out-File -FilePath $outFile -Append 'Id: ' + $sensor.ID | Out-File -FilePath $outFile -Append 'Name: ' + $sensor.Name | Out-File -FilePath $outFile -Append

  1. $sensor | Format-Table -AutoSize | Out-File -FilePath $outFile -Append $query | Format-Table -AutoSize | Out-File -FilePath $outFile -Append
  2. $sensor | Get-ObjectProperty | Out-File -FilePath $outFile -Append $sensor | Get-ObjectProperty Tags,IntervalErrorMode,Priority,Interval | Out-File -FilePath $outFile -Append $sensor | Get-Channel | Format-Table -AutoSize | Out-File -FilePath $outFile -Append

May you please share the script format to extract this info


Article Comments

I assume you are using the PrtgAPI module (https://github.com/lordmilko/PrtgAPI/).

using the "Get-ObjectProperty" Cmdlet you can get all properties from the sensors like

# script name
(Get-Sensor -Id 20089 | Get-ObjectProperty).ExeFile
# script parameters
(Get-Sensor -Id 20089 | Get-ObjectProperty).ExeParameters

Jul, 2020 - Permalink