< Back

Get-Object

Sun Jan 19, 2020 5:41 pm

NAME Get-Object



SYNOPSIS

Retrieves objects from a PRTG Server.





SYNTAX

Get-Object [[-Name] <string[]>] [[-Filter] <SearchFilter[]>] [-Count <int>] [-Id <int[]>] [-Object <PrtgObject>]

[-Resolve <SwitchParameter>] [-Type <StringEnum`1[]>] [<CommonParameters>]





DESCRIPTION

The Get-Object cmdlet retrieves objects from a PRTG Server. Get-Object is capable of retrieving any object with a

unique identifier within the PRTG object hierarchy, including internal system nodes.



By default, any objects returned by the Get-Object cmdlet are returned in their raw PrtgObject state. For objects

that are natively supported by PrtgAPI's type system, these objects can be transformed into their "true" forms by

specifying the -Resolve parameter. When specified, Get-Object will group objects of a similar type up together to

re-retrieve them via as few API calls as possible. As objects must effectively be retrieved twice, care should be

taken when attempting to resolve a large number of objects.



Objects returned by Get-Object can be limited those of a particular ObjectType by specifying the -Type parameter.

When filtering by sensors, the underlying raw type name must be specified (e.g. "ping", "wmivolume"). If the

generic object type Sensor is specified, Get-Object will refrain from filtering by type server side, such that the

complete type of each object may be inspected client side.



The PRTG object hierarchy can also be explored by specifying the parent -Object to retrieve children of. When an

-Object is specified, only children directly descended from the specified object will be returned.





PARAMETERS

-Object <PrtgObject>

The object to retrieve direct descendents of.



Required? false

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Resolve <SwitchParameter>

Specifies that returned objects should be resolved to their most derived object types (Sensor, Device, Probe,

etc.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Type <StringEnum`1[]>

Filter results to those of a specified ObjectType.



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



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

The object to retrieve direct descendents of.



PrtgAPI.SearchFilter[]

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





OUTPUTS

PrtgAPI.PrtgObject





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



C:\\> Get-Object



Retrieve all uniquely identifiable objects.



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



C:\\> Get-Object -Id 810



Retrieve the object with ID 810 (Web Server Options).



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



C:\\> Get-Object *report*



Retrieve all objects whose name contains "report".



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



C:\\> Get-Object -Type Device,System



Retrieve all Device and System objects.



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



C:\\> Get-Object -Type wmivolume -Resolve



Get all WMI Volume sensor objects and resolve them to objects of type Sensor.



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



C:\\> Get-Object -Id -3 | Get-Object



Retrieve all objects under the system "Notifications" object.



RELATED LINKS

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

Get-Sensor

Get-Device

Get-Group

Get-Probe

Get-NotificationAction

Get-PrtgSchedule

Get-ObjectProperty

Set-ObjectProperty