PrtgAPI allows you to retrieve and modify sensor settings using the Get-ObjectProperty and Set-ObjectProperty cmdlets. These cmdlets support a wide range of sensor-specific properties in a typesafe manner.
Support Status Definitions
When working with properties, the following status indicators describe how you can interact with them:
Yes: Fully supported for both Get and Set.Read-Only: Supports Get, but will never support Set.No: Not currently supported via typesafe methods.Direct: Supports both Get and Set, but can only be retrieved via direct requests.GetDirect: Supports Get via direct requests, but will never support Set.
Using Raw Properties
If a property is not currently supported by the typesafe API (marked as No), you can still interact with it using the -RawProperty and -RawValue parameters in the Get-ObjectProperty and Set-ObjectProperty cmdlets. This allows you to bypass the typesafe layer and interact with the underlying PRTG values directly.
Supported Sensor Property Groups
Properties are categorized by the type of sensor being managed. Common groups include:
Basic Sensor Settings
Name (Yes/Yes): Name of the sensor.Tags (Yes/No): Tags applied to this object.Priority (Yes/Yes): Priority of the sensor.ParentTags (Read-Only/No): Tags inherited from the parent object.
HTTP Specific
Url (Yes/Yes): URL to monitor.HttpRequestMethod (Yes/Yes): Request method (e.g., GET, POST).PostData (Yes/Yes): Data to include in POST requests.Timeout (Yes/Yes): Timeout for HTTP requests.UseSNIFromUrl (Yes/Yes): Whether to use SNI from the URL or parent device.
Ping Settings
Timeout (Yes/Yes): Timeout for Ping requests.PingMode (Yes/Yes): Whether to send a single or multiple pings.PingCount (Yes/Yes): Number of pings to send when PingMode is MultiPing.PingDelay (Yes/Yes): Delay between each ping when PingMode is MultiPing.PingPacketSize (Yes/Yes): Packet size (1-10,000 bytes).
EXE/XML Settings
ExeFile (Yes/Yes): EXE/Script file to execute.ExeParameters (Yes/Yes): Parameters to pass to the file.UseWindowsAuthentication (Yes/Yes): Whether to run with credentials of the Device or the Probe Service.Mutex (Yes/Yes): Mutex to execute related sensors sequentially.
WMI Service Monitor
ServiceName (Read-Only/No): The name of the service being monitored.StartStopped (Yes/Yes): Whether PRTG should start the target service if stopped/crashed.MonitorPerformance (Yes/Yes): Whether to monitor additional performance metrics.
Database Specific
Database (Yes/Yes): The name of the database to monitor.SqlServerQuery (Direct/No): The SQL query file to execute (accessed via direct requests).SqlInputParameter (Yes/Yes): Input parameters to the SQL query file.
# Retrieve all properties of a sensor
Get-Sensor -Id 1001 | Get-ObjectProperty
# Modify a specific property (e.g., scanning interval)
Get-Sensor -Id 1001 | Set-ObjectProperty Interval "00:00:30"
# Use Raw properties for unsupported settings
Get-Sensor -Id 1001 | Get-ObjectProperty -RawProperty Name
Get-Sensor -Id 1001 | Set-ObjectProperty -RawProperty name_ -RawValue test