< Back

Rename-Object

Sun Jan 19, 2020 5:44 pm

NAME Rename-Object



SYNOPSIS

Renames a PRTG object.





SYNTAX

Rename-Object [-Name] <string> -Object <PrtgObject> [-Batch <SwitchParameter>] [-PassThru <SwitchParameter>]

[<CommonParameters>]



Rename-Object [-Name] <string> -Id <int[]> [-Batch <SwitchParameter>] [-PassThru <SwitchParameter>]

[<CommonParameters>]





DESCRIPTION

The Rename-Object cmdlet allows you to rename a Sensor, Device, Group or Probe within PRTG. When renaming objects,

it is recommended to first execute Rename-Object first with the -WhatIf parameter. This will show you all the

objects that will be renamed when you execute the command normally.



By default, Rename-Object will operate in Batch Mode. In Batch Mode, Rename-Object will not execute a request for

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

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



If the pipeline is cancelled (either due to a cmdlet throwing an exception or the user pressing Ctrl-C) before

fully completing, Rename-Object will not generate a request against PRTG. If you wish to disable Batch Mode and

fully process objects individually one at a time, this can be achieved by specifying -Batch:$false.





PARAMETERS

-Object <PrtgObject>

The object to rename.



Required? true

Position? named

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Id <int[]>

The ID of the object to rename.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Name <string>

The new name to give the object.



Required? true

Position? 0

Default value

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 True

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





OUTPUTS



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



C:\\> Get-Sensor Memory | Rename-Object "Memory Free"



Rename all objects named "Memory" (case insensitive) to "Memory Free"



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



C:\\> Get-Sensor Memory | Rename-Object "Memory Free" -WhatIf

What if: Performing the operation "Rename-Object" on target "'Memory' (ID: 2001)"



Preview what will happen when you attempt to rename all objects named "Memory"



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



C:\\> Rename-Object -Id 1001 "Memory Free"



Rename the object with ID 1001 to "Memory Free"



RELATED LINKS

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

Get-Sensor

Get-Device

Get-Group

Get-Probe