< Back
New-GroupNode
Post
NAME New-GroupNode
SYNOPSIS
Creates a new GroupNode for modelling a PRTG Tree.
SYNTAX
New-GroupNode [-Value] <Group> [[-ScriptBlock] <ScriptBlock>] [<CommonParameters>]
New-GroupNode [-Value] <Group> -Children <PrtgNode[]> [<CommonParameters>]
New-GroupNode [[-Name] <object[]>] [[-ScriptBlock] <ScriptBlock>] [-Id <int[]>] [<CommonParameters>]
New-GroupNode [[-Name] <object[]>] -Children <PrtgNode[]> [-Id <int[]>] [<CommonParameters>]
DESCRIPTION
The New-GroupNode cmdlet creates a new GroupNode object for modelling a PRTG Tree. Each GroupNode object
encapsulates a single Group object along with any optional children (such as DeviceNode and other GroupNode items).
New-GroupNode 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 Group to encapsulate, and the
nodes that should be used as the children of the node.
If an existing Group object retrieved from the Get-Group 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 GroupNode 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, GroupNode will incorporate a copy of the children in each GroupNode
that is produced. While each GroupNode will end up with a unique copy of all its descendant nodes, the underlying
Value of each nodw will be the same.
PARAMETERS
-Value <Group>
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.Group
The value to use for the node.
PrtgAPI.Tree.PrtgNode[]
The children to use for the node.
OUTPUTS
---------- EXAMPLE 1 ----------
C:\\> Get-Group -Id 3001 | New-GroupNode
Create a group node from the group with ID 3001.
---------- EXAMPLE 2 ----------
C:\\> New-GroupNode -Id 3001
Create a group node from the group with ID 3001.
---------- EXAMPLE 3 ----------
C:\\> New-GroupNode windows*
Create a group node for each group whose name starts with "windows".
---------- EXAMPLE 4 ----------
C:\\> GroupNode -Id 3001 {
>> DeviceNode -Id 2001 {
>> SensorNode -Id 1001
>> }
>>
>> DeviceNode -Id 2002 {
>> SensorNode -Id 1002
>> }
>> }
Create a new group node from the object with ID 3001 with child nodes for the devices with IDs 2001 and 2002,
which contain the sensors with IDs 1001 and 1002 respectively.
---------- EXAMPLE 5 ----------
New-Device -Id 2001,2002 | New-GroupNode -Id 3001
Create a new group node from the object with ID 3001 with child nodes for the devices with IDs 2001 and 2002.
RELATED LINKS
Online version: https://github.com/lordmilko/PrtgAPI/wiki/Tree-Creation
Get-Group
New-SensorNode
New-DeviceNode
New-ProbeNode
New-TriggerNode
New-PropertyNode
SYNOPSIS
Creates a new GroupNode for modelling a PRTG Tree.
SYNTAX
New-GroupNode [-Value] <Group> [[-ScriptBlock] <ScriptBlock>] [<CommonParameters>]
New-GroupNode [-Value] <Group> -Children <PrtgNode[]> [<CommonParameters>]
New-GroupNode [[-Name] <object[]>] [[-ScriptBlock] <ScriptBlock>] [-Id <int[]>] [<CommonParameters>]
New-GroupNode [[-Name] <object[]>] -Children <PrtgNode[]> [-Id <int[]>] [<CommonParameters>]
DESCRIPTION
The New-GroupNode cmdlet creates a new GroupNode object for modelling a PRTG Tree. Each GroupNode object
encapsulates a single Group object along with any optional children (such as DeviceNode and other GroupNode items).
New-GroupNode 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 Group to encapsulate, and the
nodes that should be used as the children of the node.
If an existing Group object retrieved from the Get-Group 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 GroupNode 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, GroupNode will incorporate a copy of the children in each GroupNode
that is produced. While each GroupNode will end up with a unique copy of all its descendant nodes, the underlying
Value of each nodw will be the same.
PARAMETERS
-Value <Group>
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.Group
The value to use for the node.
PrtgAPI.Tree.PrtgNode[]
The children to use for the node.
OUTPUTS
---------- EXAMPLE 1 ----------
C:\\> Get-Group -Id 3001 | New-GroupNode
Create a group node from the group with ID 3001.
---------- EXAMPLE 2 ----------
C:\\> New-GroupNode -Id 3001
Create a group node from the group with ID 3001.
---------- EXAMPLE 3 ----------
C:\\> New-GroupNode windows*
Create a group node for each group whose name starts with "windows".
---------- EXAMPLE 4 ----------
C:\\> GroupNode -Id 3001 {
>> DeviceNode -Id 2001 {
>> SensorNode -Id 1001
>> }
>>
>> DeviceNode -Id 2002 {
>> SensorNode -Id 1002
>> }
>> }
Create a new group node from the object with ID 3001 with child nodes for the devices with IDs 2001 and 2002,
which contain the sensors with IDs 1001 and 1002 respectively.
---------- EXAMPLE 5 ----------
New-Device -Id 2001,2002 | New-GroupNode -Id 3001
Create a new group node from the object with ID 3001 with child nodes for the devices with IDs 2001 and 2002.
RELATED LINKS
Online version: https://github.com/lordmilko/PrtgAPI/wiki/Tree-Creation
Get-Group
New-SensorNode
New-DeviceNode
New-ProbeNode
New-TriggerNode
New-PropertyNode