< Back

Add-Group

Sun Jan 19, 2020 5:39 pm

NAME Add-Group



SYNOPSIS

Adds a new group to a PRTG Group or Probe.





SYNTAX

Add-Group [-Parameters] <NewGroupParameters> -Destination <GroupOrProbe> [-Resolve <SwitchParameter>]

[<CommonParameters>]



Add-Group [-Name] <string> -Destination <GroupOrProbe> [-Resolve <SwitchParameter>] [<CommonParameters>]





DESCRIPTION

The Add-Group cmdlet adds a new group to a a PRTG Group or Probe. When adding a new group, Add-Group supports two

methods of specifying the parameters required to create the object. For basic scenarios where you inherit all

settings from the parent object, a group can created by passing nothing more than a Name to Add-Group.



For more advanced scenarios where you wish to specify more advanced parameters (such as Tags that will apply to

the group) a NewGroupParameters object can be instead created with the New-GroupParameters cmdlet. When the

parameters object is passed to Add-Device, PrtgAPI will validate that all mandatory parameter fields contain

values. If a mandatory field is missing a value, Add-Sensor will throw an InvalidOperationException, listing the

field whose value was missing.



By default, Add-Group will attempt to resolve the created group to a Group object. As PRTG does not return the ID

of the created object, PrtgAPI identifies the newly created group by comparing the groups under the parent object

before and after the new group is created. While this is generally very reliable, in the event something or

someone else creates another new group directly under the target object with the same Name, that object will also

be returned in the objects resolved by Add-Group. If you do not wish to resolve the created group, this behavior

can be disabled by specifying -Resolve:$false.





PARAMETERS

-Destination <GroupOrProbe>

The parent object to create an object under.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Parameters <NewGroupParameters>

A set of parameters whose properties describe the type of object to add, with what settings.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <string>

The name to use for the group.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Resolve <SwitchParameter>

Indicates whether or not the new object should be resolved to a PrtgObject. By default this value is Present.



Required? false

Position? named

Default value True

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.GroupOrProbe

The parent object to create an object under.





OUTPUTS



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



C:\\> Get-Probe contoso | Add-Group Servers



Add a new group called "Servers" to the Contoso probe.



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



C:\\> $params = New-GroupParameters Servers

C:\\> $params.Tags = "awesomeGroup"



C:\\> Get-Probe contoso | Add-Device $params



Add a new group called "Servers" with custom tags to the Contoso probe.



RELATED LINKS

Online version: https://github.com/lordmilko/PrtgAPI/wi ... n#groups-1

New-GroupParameters

Get-Group

Get-Probe