< Back

Add-Device

Sun Jan 19, 2020 5:39 pm

NAME Add-Device



SYNOPSIS

Adds a new device to a PRTG Group or Probe.





SYNTAX

Add-Device [-Parameters] <NewDeviceParameters> -Destination <GroupOrProbe> [-Resolve <SwitchParameter>]

[<CommonParameters>]



Add-Device [-Name] <string> [[-Host] <string>] -Destination <GroupOrProbe> [-AutoDiscover <SwitchParameter>]

[-Resolve <SwitchParameter>] [-Template <string[]>] [<CommonParameters>]





DESCRIPTION

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

two methods of specifying the parameters required to create the object. For basic scenarios where you wish to

inherit all settings from the parent object, the Name, Host and auto-discovery method can all be specified as

arguments directly to Add-Device. If a -Host is not specified, Add-Device will automatically use the -Name as the

device's hostname. If -AutoDiscover is specified, Add-Device will perform an Automatic auto-discovery.



For more advanced scenarios where you wish to specify more advanced parameters (such as the Internet Protocol

version used to communicate with the device) a NewDeviceParameters object can instead be created with the

New-DeviceParameters 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-Device will attempt to resolve the created device to a Device object. As PRTG does not return the

ID of the created object, PrtgAPI identifies the newly created device by comparing the devices under the parent

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

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

also be returned in the objects resolved by Add-Device. If you do not wish to resolve the created device, 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 <NewDeviceParameters>

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 device. If a Host is not specified, this value will be used as the hostname as well.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Host <string>

The IPv4 Address/HostName to use for monitoring this device. If this value is not specified, the Name will be

used as the hostname.



Required? false

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-AutoDiscover <SwitchParameter>

Whether to perform an Automatic auto-discovery on the newly created device.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Template <string[]>

One or more wildcards specifying the device templates to used when performing the auto-discovery. If no

templates are specified, all templates will be used.



Required? false

Position? named

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-Device dc-1



Add a new device named "dc-1" to the Contoso probe, using "dc-1" as its hostname, without performing an automatic

auto-discovery.



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



C:\\> Get-Group -Id 2305 | Add-Device exch-1 192.168.0.2 -AutoDiscover



Add a device named "exch-1" to the group with ID 2305, using 192.168.0.2 as its IP Address and performing an

automatic auto-discovery after the device is created.



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



C:\\> $params = New-DeviceParameters sql-1 "2001:db8::ff00:42:8329"

C:\\> $params.IPVersion = "IPv6"



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



Add a device named sql-1 using an IPv6 Address to the probe Contoso probe.



RELATED LINKS

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

New-DeviceParameters

Get-Group

Get-Probe