< Back

Remove-Object

Sun Jan 19, 2020 5:44 pm

NAME Remove-Object



SYNOPSIS

Permanently removes an object from PRTG.





SYNTAX

Remove-Object -Object <PrtgObject> [-Batch <SwitchParameter>] [-Force <SwitchParameter>] [-PassThru

<SwitchParameter>] [<CommonParameters>]



Remove-Object -Id <int[]> [-Batch <SwitchParameter>] [-Force <SwitchParameter>] [-PassThru <SwitchParameter>]

[<CommonParameters>]





DESCRIPTION

The Remove-Object cmdlet permanently removes an object from PRTG. Some objects cannot be deleted (e.g. the root

PRTG group (ID 0) and will generate an exception if you attempt to do so.



If invoked with no arguments other than the object to be deleted, Remove-Object will prompt for confirmation of

each object to be deleted. If you wish to delete multiple objects, it is recommend to first run Remove-Object with

the -WhatIf parameter, and then re-run with the -Force parameter if the results of -WhatIf look correct.



Remove-Object is capable of operating in Batch Mode. In Batch Mode, Remove-Object will not execute a request for

each individual object, but will rather store each item in a queue to remove all objects at once, via a single

request. This allows PrtgAPI to be extremely performant in performing operations against a large number of

objects. Due to the inherent danger in batch removing multiple objects so quickly, Remove-Object will only operate

in Batch mode if -Batch is specified. If Remove-Object is invoked with -Force, -Batch mode will be automatically

enabled unless specified otherwise.



When invoked with -WhatIf, Remove-Object will list all objects that would have been deleted, along with their

corresponding object IDs. Even if you are sure of the objects you wish to delete, it is recommended to always run

with -WhatIf first to confirm you have specified the correct objects and that PrtgAPI has interpreted your request

in the way you intended.





PARAMETERS

-Object <PrtgObject>

The object to remove.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Id <int[]>

The ID of the object to remove.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Force <SwitchParameter>

Forces an object to be removed without displaying a confirmation prompt.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Batch <SwitchParameter>

Specifies whether this cmdlet should queue all objects piped to this cmdlet to execute a single request

against PRTG for processing all objects. By default this value is true.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-PassThru <SwitchParameter>

Specifies whether to return the original PrtgObject that was passed to this cmdlet, allowing the object to be

further piped into additional cmdlets.



Required? false

Position? named

Default value False

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





OUTPUTS



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



C:\\> Get-Device dc-1 | Remove-Object -WhatIf

"What if: Performing the operation "Remove-Object" on target "'dc-1' (ID: 2001)""



Preview what will happen when you attempt to remove all devices named 'dc-1'



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



C:\\> Get-Device dc-1 | Remove-Object -Force



Remove all devices with name 'dc-1' without prompting for confirmation.



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



C:\\> Remove-Object -Id 1001 -Force



Removes the object with ID 1001 without prompting for confirmation.



RELATED LINKS

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

Get-Sensor

Get-Device

Get-Group

Get-Probe