< Back

Get-SensorTarget

Sun Jan 19, 2020 5:42 pm

NAME Get-SensorTarget



SYNOPSIS

Retrieves system resources that capable of being monitored or used for monitoring by a new PRTG Sensor.





SYNTAX

Get-SensorTarget [-Type] {ExeXml | WmiService | SqlServerDB | Http | Factory} [[-Name] <string[]>] -Device

<Device> [-Parameters <SwitchParameter>] [-Timeout <int>] [<CommonParameters>]



Get-SensorTarget [[-Name] <string[]>] -Device <Device> -RawType <string> [-QueryParameters <Hashtable>]

[-QueryTarget <SensorQueryTarget>] [-Table <string>] [-Timeout <int>] [<CommonParameters>]





DESCRIPTION

Get-SensorTarget cmdlet identifies resources that are capable of being used as the target of a new PRTG Sensor.

The resources identified by Get-SensorTarget are dynamic in nature. When Get-SensorTarget is executed, the PRTG

will interrogate the PRTG Probe of the specified device in order to identify the resources that are compatible

with the target system. For example, for creating a new WMI Service sensor, PRTG will request the probe enumerate

all of the system services that are installed on the target device.



For convenience, Get-SensorTarget allows specifying a -Name used to filter the returned results. Typically, items

returned by Get-SensorTarget should be sent straight to a call to New-SensorParameters, however if you do not wish

to perform any other processing on the results returned by this cmdlet you may automatically generate a set of

parameters for the specified sensor type by specifying the -Parameters (alias: -Params) parameter. When creating

sensor parameters with the -Params parameter, the default sensor name of the specified sensor type will be used.



Sensor types not supported by PrtgAPI can still be interrogated by Get-SensorTarget via the -RawType parameter.

Raw sensor type names can be found by inspecting the Id column of items output from the Get-SensorType cmdlet.

When operating on raw types, by default Get-SensorTarget will attempt to guess the name of the data table within

PRTG the sensor targets are stored in. If PRTG detects more than one data table exists, an ArgumentException will

be thrown listing the names of all of the available tables. The name of the table to use can then be specified to

the -Table parameter.



Sensor targets identified for raw types are represented as a "generic" sensor target type. Generic sensor targets

allow accessing both their Name and Value as named properties. Any other properties of the sensor target can be

obtained by accessing the Properties array of the object. Generic sensor targets capable of being used with any

NewSensorParameters type, including RawSensorParameters and DynamicSensorParameters.



While resources returned by Get-SensorTarget are guaranteed to be compatible with the target device, there is no

restriction preventing such resources from being used on other devices as well. Attempting to create a sensor on

an incompatible device may succeed, however the sensor will likely enter a Down state upon refreshing, similar to

what would happen if the sensor were created normally and then the sensor's target was deleted.





PARAMETERS

-Device <Device>

The device to retrieve sensor targets from. While results returned by Get-SensorTarget are guaranteed to be

compatible with the specified device, returned objects may also be compatible with other devices in PRTG.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Type <SensorType>

The type of sensor target to query for. Not all sensor types may require or support target resolution.



Possible values: ExeXml, WmiService, SqlServerDB, Http, Factory



Required? true

Position? 0

Default value ExeXml

Accept pipeline input? false

Accept wildcard characters? false



-Name <string[]>

An expression used to filter returned results to those with a specified name.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Parameters <SwitchParameter>

When present, specifies that Get-SensorTarget should automatically wrap the returned items up in a set of

sensor parameters applicable to the specified sensor type.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Params <SwitchParameter>

When present, specifies that Get-SensorTarget should automatically wrap the returned items up in a set of

sensor parameters applicable to the specified sensor type.



This is an alias of the Parameters parameter.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-RawType <string>

The raw type of sensor target to query for. Types that require additional information before querying (such as

Oracle Tablespace) cannot be queried.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-QueryTarget <SensorQueryTarget>

A sensor query target to use when retrieving dynamic sensor parameters. Can include wildcards.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-qt <SensorQueryTarget>

A sensor query target to use when retrieving dynamic sensor parameters. Can include wildcards.



This is an alias of the QueryTarget parameter.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-QueryParameters <Hashtable>

A set of sensor query target parameters to use when retrieving dynamic sensor parameters.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-qp <Hashtable>

A set of sensor query target parameters to use when retrieving dynamic sensor parameters.



This is an alias of the QueryParameters parameter.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Table <string>

The name of the Dropdown List or Checkbox Group the sensor targets belong to. If this value is null, PrtgAPI

will attempt to guess the name of the table. If this value cannot be guessed or is not valid, an

ArgumentException will be thrown listing all possible values.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Timeout <int>

Duration (in seconds) to wait for sensor targets to resolve.



Required? false

Position? named

Default value 60

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

PrtgAPI.Device

The device to retrieve sensor targets from. While results returned by Get-SensorTarget are guaranteed to be

compatible with the specified device, returned objects may also be compatible with other devices in PRTG.





OUTPUTS

PrtgAPI.Targets.SensorTarget`1





---------- EXAMPLE 1 ----------



C:\\> $device = Get-Device -Id 1001



C:\\> $services = $device | Get-SensorTarget WmiService *exchange*



C:\\> $params = New-SensorParameters WmiService $services



C:\\> $device | Add-Sensor $params



Add all WMI Services whose name contains "Exchange" to the Device with ID 1001



---------- EXAMPLE 2 ----------



C:\\> $device = Get-Device -Id 1001



C:\\> $params = $device | Get-SensorTarget WmiService *exchange* -Params



C:\\> $device | Add-Sensor $params



Add all WMI Services whose name contains "Exchange" to the Device with ID 1001, creating sensor parameters

immediately.



---------- EXAMPLE 3 ----------



C:\\> $targets = Get-Device -Id 1001 | Get-SensorTarget -RawType vmwaredatastoreextern



Get all VMware Datastores from the device with ID 1001.



---------- EXAMPLE 4 ----------



C:\\> $targets = Get-Device -Id 1001 | Get-SensorTarget -RawType wmivolume



C:\\> $targets | foreach { $_.Properties[3] }



List the disk type (Local Disk, Compact Disk etc) of all WMI Volume targets.



---------- EXAMPLE 5 ----------



C:\\> $params = Get-Device -Id 1001 | Get-SensorTarget -RawType snmplibrary -qt *ups*



Get all sensor targets that can be used on an SNMP Library sensor using the sensor query target "APC UPS.oidlib".



---------- EXAMPLE 6 ----------



C:\\> $target = (Get-SensorType snmplibrary -Id 1001).QueryTargets | where Value -like *ups*

C:\\> $params = Get-Device -Id 1001 | Get-SensorTarget -RawType snmplibrary -qt $target



Get all sensor targets that can be used on an SNMP Library sensor using the sensor query target "APC UPS.oidlib".



---------- EXAMPLE 7 ----------



C:\\> $params = Get-Device -Id 1001 | New-SensorParameters -RawType ipmisensor -qp @{ username = "admin"; password

= "password" }



Get all sensor targets that can be used on an IPMI Sensor, specifying the query target parameters required to

authenticate to IPMI.



RELATED LINKS

Online version: https://github.com/lordmilko/PrtgAPI/wi ... powershell

New-SensorParameters

Add-Sensor

Get-Device

Get-SensorType