< Back

Get-Device

Sun Jan 19, 2020 5:40 pm

NAME Get-Device



SYNOPSIS

Retrieves devices from a PRTG Server.





SYNTAX

Get-Device [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Access {Inherited | None | Read | Write | Full |

Admin}] [-Active <bool[]>] [-BaseType {Sensor | Device | Group | Probe}] [-Comments <string[]>] [-Condition

<string[]>] [-Count <int>] [-Dependency <string[]>] [-DownAcknowledgedSensors <int[]>] [-DownSensors <int[]>]

[-Favorite <bool[]>] [-Group <NameOrObject`1>] [-Host <string[]>] [-Id <int[]>] [-Interval <TimeSpan[]>]

[-Location <string[]>] [-Message <string[]>] [-ParentId <int[]>] [-PartialDownSensors <int[]>] [-PausedSensors

<int[]>] [-Position <int[]>] [-Priority {None | One | Two | Three | Four | Five}] [-Probe <NameOrObject`1>]

[-Recurse <SwitchParameter>] [-Schedule <string[]>] [-Status {None | Unknown | Collecting | Up | Warning | Down |

NoProbe | PausedByUser | PausedByDependency | PausedBySchedule | Unusual | PausedByLicense | PausedUntil |

DownAcknowledged | DownPartial | Paused}] [-Tags <string[]>] [-TotalSensors <int[]>] [-Type <StringEnum`1[]>]

[-UnknownSensors <int[]>] [-UnusualSensors <int[]>] [-UpSensors <int[]>] [-Url <string[]>] [-WarningSensors

<int[]>] [<CommonParameters>]



Get-Device [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Access {Inherited | None | Read | Write | Full |

Admin}] [-Active <bool[]>] [-BaseType {Sensor | Device | Group | Probe}] [-Comments <string[]>] [-Condition

<string[]>] [-Count <int>] [-Dependency <string[]>] [-DownAcknowledgedSensors <int[]>] [-DownSensors <int[]>]

[-Favorite <bool[]>] [-Group <NameOrObject`1>] [-Host <string[]>] [-Id <int[]>] [-Interval <TimeSpan[]>]

[-Location <string[]>] [-Message <string[]>] [-ParentId <int[]>] [-PartialDownSensors <int[]>] [-PausedSensors

<int[]>] [-Position <int[]>] [-Priority {None | One | Two | Three | Four | Five}] [-Probe <NameOrObject`1>]

[-Recurse <SwitchParameter>] [-Schedule <string[]>] [-Status {None | Unknown | Collecting | Up | Warning | Down |

NoProbe | PausedByUser | PausedByDependency | PausedBySchedule | Unusual | PausedByLicense | PausedUntil |

DownAcknowledged | DownPartial | Paused}] [-Tag <string[]>] [-TotalSensors <int[]>] [-Type <StringEnum`1[]>]

[-UnknownSensors <int[]>] [-UnusualSensors <int[]>] [-UpSensors <int[]>] [-Url <string[]>] [-WarningSensors

<int[]>] [<CommonParameters>]





DESCRIPTION

The Get-Device cmdlet retrieves devices from a PRTG Server. Devices hold sensors used to monitor a particular

system. Get-Device provides a variety of methods of filtering the devices requested from PRTG, including by device

name, ID and tags, as well as parent probe/group. Multiple filters can be used in conjunction to futher limit the

number of results returned. Device properties that do not contain explicitly defined parameters on Get-Device can

be specified as dynamic parameters, allowing one or more values to be specified of the specified type. All string

parameters support the use of wildcards.



For scenarios in which you wish to exert finer grained control over search filters, a custom SearchFilter object

can be created by specifying the field name, condition and value to filter upon. For information on properties

that can be filtered upon, see New-SearchFilter.



Get-Device provides two parameter sets for filtering objects by tags. When filtering for devices that contain one

of several tags, the -Tag parameter can be used, performing a logical OR between all specified operands. For

scenarios in which you wish to filter for devices containing ALL specified tags, the -Tags parameter can be used,

performing a logical AND between all specified operands.



When requesting devices belonging to a specified group, PRTG will not return any objects that may be present under

further child groups of the parent group. To work around this, by default Get-Device will automatically recurse

child groups if it detects the initial device request did not return all items (as evidenced by the parent group's

TotalDevices property. If you do not wish Get-Device to recurse child groups, this behavior can be overridden by

specifying -Recurse:$false.



The Device objects returned from Get-Device can be piped to a variety of other cmdlets for further processing,

including Get-Sensor, wherein the ID of each device will be used to filter for its parent sensors.





PARAMETERS

-Group <NameOrObject`1>

The group to retrieve devices for.



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Probe <NameOrObject`1>

The probe to retrieve devices for.



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Host <string[]>

Filter the response to devices with a certain HostName/IP Address. Can include wildcards.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Recurse <SwitchParameter>

When piping from a Group, specifies that PrtgAPI should also recursively traverse all subgroups until all

objects that should be returned by this cmdlet have been found. By default this value is true. If this value

is false, PrtgAPI will not return objects from under any subgroups of the target group.



Required? false

Position? named

Default value True

Accept pipeline input? false

Accept wildcard characters? false



-Status <Status[]>

Only retrieve objects that match a specific status.



Possible values: None, Unknown, Collecting, Up, Warning, Down, NoProbe, PausedByUser, PausedByDependency,

PausedBySchedule, Unusual, PausedByLicense, PausedUntil, DownAcknowledged, DownPartial, Paused



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tags <string[]>

Filter the response to objects with all specified tags. Can include wildcards.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tag <string[]>

Filter the response to objects with one of several tags. Can include wildcards.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Id <int[]>

Retrieve an object with a specified ID.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <string[]>

Filter the response to objects with a certain name. Can include wildcards.



Required? false

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Filter <SearchFilter[]>

Filter the response to objects that match one or more criteria.



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Count <int>

Maximum number of results to return. Note: when this parameter is specified wildcard filters such as Name may

behave unexpectedly when wildcard characters are not used and records are being filtered by an additional

property other than ParentId.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Type <StringEnum`1[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Active <bool[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Interval <TimeSpan[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Access <Access[]>

Possible values: Inherited, None, Read, Write, Full, Admin



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Dependency <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Message <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Priority <Priority[]>

Possible values: None, One, Two, Three, Four, Five



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UpSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DownSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DownAcknowledgedSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PartialDownSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-WarningSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PausedSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UnusualSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UnknownSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-TotalSensors <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Favorite <bool[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Schedule <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Comments <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Condition <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BaseType <BaseType[]>

Possible values: Sensor, Device, Group, Probe



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Url <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ParentId <int[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Location <string[]>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Position <int[]>



Required? false

Position? named

Default value

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.PowerShell.NameOrObject`1[[PrtgAPI.Group, PrtgAPI, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null]]

The group to retrieve devices for.



PrtgAPI.PowerShell.NameOrObject`1[[PrtgAPI.Probe, PrtgAPI, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null]]

The probe to retrieve devices for.



PrtgAPI.SearchFilter[]

Filter the response to objects that match one or more criteria.





OUTPUTS

PrtgAPI.Device





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



C:\\> Get-Device dc-1



Get all devices named "dc-1" (case insensitive)



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



C:\\> Get-Device *exch*



Get all devices whose name contains "exch" (case insensitive)



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



C:\\> Get-Device -Id 2000



Get the device with ID 2000



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



C:\\> Get-Probe contoso | Get-Device



Get all devices from the probe named "contoso"



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



C:\\> Get-Device -Tag C_OS_Win,exch



Get all devices that have the tag "C_OS_Win" or "exch"



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



C:\\> Get-Device -Tags ny,C_OS_Win



Get all Windows servers in New York



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



C:\\> Get-Device -Count 1



Get only 1 device from PRTG.



---------- EXAMPLE 8 ----------



C:\\> Get-Device -Location "*new york*"



Get all devices whose location contains "new york" using a dynamic parameter.



---------- EXAMPLE 9 ----------



C:\\> flt location contains "new york" | Get-Device



Get all devices whose location contains "new york" using a SearchFilter.



---------- EXAMPLE 10 ----------



C:\\> Get-Group -Id 2001 | Get-Device -Recurse:$false



Get all devices directly under the specified group, ignoring all child groups.



RELATED LINKS

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

Get-Sensor

Get-Group

Get-Probe

New-SearchFilter

Add-Device