< Back
New-SensorNode
Post
NAME New-SensorNode
SYNOPSIS
Creates a new SensorNode for modelling a PRTG Tree.
SYNTAX
New-SensorNode [-Value] <Sensor> [[-ScriptBlock] <ScriptBlock>] [<CommonParameters>]
New-SensorNode [-Value] <Sensor> -Children <PrtgNode[]> [<CommonParameters>]
New-SensorNode [[-Name] <object[]>] [[-ScriptBlock] <ScriptBlock>] [-Id <int[]>] [<CommonParameters>]
New-SensorNode [[-Name] <object[]>] -Children <PrtgNode[]> [-Id <int[]>] [<CommonParameters>]
DESCRIPTION
The New-SensorNode cmdlet creates a new SensorNode object for modelling a PRTG Tree. Each SensorNode object
encapsulates a single Sensor object along with any optional children (such as TriggerNode and PropertyNode items).
New-SensorNode supports many different ways of being invoked, however at its core there are two pieces of
information that can be provided to the cmdlet: information that identifies the Sensor to encapsulate, and the
nodes that should be used as the children of the node.
If an existing Sensor object retrieved from the Get-Sensor cmdlet is not specified or piped to the -Value
parameter, one or more of -Name or -Id must be specified to identify the object to encapsulate. If multiple values
are returned as a result of these parameters, a unique SensorNode object will be created for each item.
Child nodes to this node can either be specified via the pipeline, or declaratively via a ScriptBlock. When a
ScriptBlock defining children is specified, SensorNode will incorporate a copy of the children in each SensorNode
that is produced. While each SensorNode will end up with a unique copy of all its descendant nodes, the underlying
Value of each nodw will be the same.
PARAMETERS
-Value <Sensor>
The value to use for the node.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Name <object[]>
The name of the object to retrieve. Can include wildcards.
Required? false
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Id <int[]>
The ID of the object to retrieve.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ObjectId <int[]>
The ID of the object to retrieve.
This is an alias of the Id parameter.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
A script block that returns the children to use for this node.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Children <PrtgNode[]>
The children to use for the node.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
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.Sensor
The value to use for the node.
PrtgAPI.Tree.PrtgNode[]
The children to use for the node.
OUTPUTS
---------- EXAMPLE 1 ----------
C:\\> Get-Sensor -Id 1001 | New-SensorNode
Create a sensor node from the sensor with ID 1001.
---------- EXAMPLE 2 ----------
C:\\> New-SensorNode -Id 1001
Create a sensor node from the sensor with ID 1001.
---------- EXAMPLE 3 ----------
C:\\> New-SensorNode cpu*
Create a sensor node for each sensor whose name starts with "cpu".
---------- EXAMPLE 4 ----------
C:\\> SensorNode -Id 1001 {
>> TriggerNode -ObjectId 1001
>> }
Create a new sensor node from the object with ID 1001 with child nodes for each notification trigger under that
object.
---------- EXAMPLE 5 ----------
New-TriggerNode -ObjectId 1001 | New-SensorNode -Id 1001
Create a new sensor node from the object with ID 1001 with child nodes for each notification trigger under that
object.
RELATED LINKS
Online version: https://github.com/lordmilko/PrtgAPI/wiki/Tree-Creation
Get-Sensor
New-DeviceNode
New-GroupNode
New-ProbeNode
New-TriggerNode
New-PropertyNode
SYNOPSIS
Creates a new SensorNode for modelling a PRTG Tree.
SYNTAX
New-SensorNode [-Value] <Sensor> [[-ScriptBlock] <ScriptBlock>] [<CommonParameters>]
New-SensorNode [-Value] <Sensor> -Children <PrtgNode[]> [<CommonParameters>]
New-SensorNode [[-Name] <object[]>] [[-ScriptBlock] <ScriptBlock>] [-Id <int[]>] [<CommonParameters>]
New-SensorNode [[-Name] <object[]>] -Children <PrtgNode[]> [-Id <int[]>] [<CommonParameters>]
DESCRIPTION
The New-SensorNode cmdlet creates a new SensorNode object for modelling a PRTG Tree. Each SensorNode object
encapsulates a single Sensor object along with any optional children (such as TriggerNode and PropertyNode items).
New-SensorNode supports many different ways of being invoked, however at its core there are two pieces of
information that can be provided to the cmdlet: information that identifies the Sensor to encapsulate, and the
nodes that should be used as the children of the node.
If an existing Sensor object retrieved from the Get-Sensor cmdlet is not specified or piped to the -Value
parameter, one or more of -Name or -Id must be specified to identify the object to encapsulate. If multiple values
are returned as a result of these parameters, a unique SensorNode object will be created for each item.
Child nodes to this node can either be specified via the pipeline, or declaratively via a ScriptBlock. When a
ScriptBlock defining children is specified, SensorNode will incorporate a copy of the children in each SensorNode
that is produced. While each SensorNode will end up with a unique copy of all its descendant nodes, the underlying
Value of each nodw will be the same.
PARAMETERS
-Value <Sensor>
The value to use for the node.
Required? true
Position? 0
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Name <object[]>
The name of the object to retrieve. Can include wildcards.
Required? false
Position? 0
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Id <int[]>
The ID of the object to retrieve.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ObjectId <int[]>
The ID of the object to retrieve.
This is an alias of the Id parameter.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ScriptBlock <ScriptBlock>
A script block that returns the children to use for this node.
Required? false
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Children <PrtgNode[]>
The children to use for the node.
Required? true
Position? named
Default value
Accept pipeline input? true (ByValue)
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.Sensor
The value to use for the node.
PrtgAPI.Tree.PrtgNode[]
The children to use for the node.
OUTPUTS
---------- EXAMPLE 1 ----------
C:\\> Get-Sensor -Id 1001 | New-SensorNode
Create a sensor node from the sensor with ID 1001.
---------- EXAMPLE 2 ----------
C:\\> New-SensorNode -Id 1001
Create a sensor node from the sensor with ID 1001.
---------- EXAMPLE 3 ----------
C:\\> New-SensorNode cpu*
Create a sensor node for each sensor whose name starts with "cpu".
---------- EXAMPLE 4 ----------
C:\\> SensorNode -Id 1001 {
>> TriggerNode -ObjectId 1001
>> }
Create a new sensor node from the object with ID 1001 with child nodes for each notification trigger under that
object.
---------- EXAMPLE 5 ----------
New-TriggerNode -ObjectId 1001 | New-SensorNode -Id 1001
Create a new sensor node from the object with ID 1001 with child nodes for each notification trigger under that
object.
RELATED LINKS
Online version: https://github.com/lordmilko/PrtgAPI/wiki/Tree-Creation
Get-Sensor
New-DeviceNode
New-GroupNode
New-ProbeNode
New-TriggerNode
New-PropertyNode