Set-NBDCIMDevice
Since
v1.0.4
SYNOPSIS
Updates one or more devices in Netbox DCIM module.
SYNTAX
Single (Default)
Set-NBDCIMDevice -Id <UInt64> [-Name <String>] [-Role <Object>] [-Device_Type <Object>] [-Site <UInt64>]
[-Status <String>] [-Platform <UInt64>] [-Tenant <UInt64>] [-Cluster <UInt64>] [-Rack <UInt64>]
[-Position <Double>] [-Face <String>] [-Serial <String>] [-Asset_Tag <String>] [-Virtual_Chassis <UInt64>]
[-VC_Priority <UInt64>] [-VC_Position <UInt64>] [-Primary_IP4 <UInt64>] [-Primary_IP6 <UInt64>]
[-Comments <String>] [-Description <String>] [-Custom_Fields <Hashtable>] [-Owner <UInt64>]
[-Location <UInt64>] [-Airflow <String>] [-OOB_IP <UInt64>] [-Latitude <Double>] [-Longitude <Double>]
[-Config_Template <UInt64>] [-Local_Context_Data <Object>] [-Force] [-Tags <Object[]>] [-Raw]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
Bulk
Set-NBDCIMDevice -InputObject <PSObject> [-BatchSize <Int32>] [-Force] [-Tags <Object[]>] [-Raw]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Updates existing devices in Netbox DCIM module. Supports both single device updates with individual parameters and bulk updates via pipeline input.
For bulk operations, use the -BatchSize parameter to control how many devices are sent per API request. Each object must have an Id property.
EXAMPLES
EXAMPLE 1
Set-NBDCIMDevice -Id 123 -Cluster $null
Clears the Cluster assignment on device 123. Also works for Platform, Tenant, Rack, Position, Virtual_Chassis, VC_Position, VC_Priority, Primary_IP4, Primary_IP6, Owner, Location, OOB_IP, Config_Template, Latitude, Longitude, and Local_Context_Data. Clear Airflow with -Airflow ''.
EXAMPLE 2
Set-NBDCIMDevice -Id 123 -Airflow front-to-rear -Latitude 52.37 -Longitude 4.89
Sets airflow direction and GPS coordinates. Pass -Airflow '' to clear airflow; pass -Latitude $null / -Longitude $null to clear coordinates.
EXAMPLE 3
Set-NBDCIMDevice -Id 123 -Description "Replaces legacy gateway"
Sets the Description. Pass -Description '' to clear it server-side.
EXAMPLE 4
Set-NBDCIMDevice -Id 123 -Status "active"
Updates device 123 to active status.
EXAMPLE 5
Get-NBDCIMDevice -Status "planned" | ForEach-Object {
[PSCustomObject]@{Id = $_.id; Status = "active"}
} | Set-NBDCIMDevice -Force
Bulk update all planned devices to active status.
EXAMPLE 6
$updates = @(
[PSCustomObject]@{Id = 100; Status = "active"; Comments = "Deployed"}
[PSCustomObject]@{Id = 101; Status = "active"; Comments = "Deployed"}
)
$updates | Set-NBDCIMDevice -BatchSize 50 -Force
Bulk update multiple devices with different values.
PARAMETERS
-Id
The database ID of the device to update. Required for single updates.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: True
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-Name
The new name for the device.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Role
The device role ID. Alias: Device_Role (backwards compatibility)
Type: Object
Parameter Sets: Single
Aliases: Device_Role
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Device_Type
The device type ID.
Type: Object
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Site
The site ID.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-Status
Status of the device.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Platform
The platform ID.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Tenant
The tenant ID.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Cluster
The cluster ID.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Rack
The rack ID.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Position
Rack-unit position (U). Accepts fractional values for half-U devices (e.g. 1.5, 2.5). Pass $null to clear (unrack the device).
Type: Double
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Face
Face of the device in the rack.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Serial
Serial number.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Asset_Tag
Asset tag.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Virtual_Chassis
Virtual Chassis.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-VC_Priority
Virtual chassis master election priority
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-VC_Position
VC Position.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Primary_IP4
Primary IPv4 address assigned to this object (database ID).
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Primary_IP6
Primary IPv6 address assigned to this object (database ID).
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Comments
Comments about the device.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Description
Short description of the device. Pass an empty string to clear the field in Netbox (Description is empty-string-compatible, not nullable).
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Custom_Fields
Hashtable of custom field values.
Type: Hashtable
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Owner
The owner ID for object ownership (Netbox 4.5+ only).
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Location
The location ID within the site. Pass $null to clear.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Airflow
Airflow direction. One of: front-to-rear, rear-to-front, left-to-right, right-to-left, side-to-rear, rear-to-side, bottom-to-top, top-to-bottom, passive, mixed. Pass an empty string ('') to clear (Airflow is enum-nullable, same idiom as Set-NBDCIMInterface -Duplex '').
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OOB_IP
Out-of-band IP address ID. Pass $null to clear.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Latitude
GPS latitude in decimal degrees (-90 to 90). Pass $null to clear.
Type: Double
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Longitude
GPS longitude in decimal degrees (-180 to 180). Pass $null to clear.
Type: Double
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Config_Template
Config template ID assigned to the device. Pass $null to clear.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Local_Context_Data
Local config context data (free-form JSON; hashtable or object). Takes precedence over source contexts. Pass $null to clear.
Type: Object
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InputObject
Pipeline input for bulk operations. Each object MUST have an Id property.
Type: PSObject
Parameter Sets: Bulk
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-BatchSize
Number of devices to update per API request in bulk mode. Default: 50, Range: 1-1000
Type: Int32
Parameter Sets: Bulk
Aliases:
Required: False
Position: Named
Default value: 100
Accept pipeline input: False
Accept wildcard characters: False
-Force
Skip confirmation prompts.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Tags
One or more tags to assign to this object (tag names or IDs).
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Raw
Return the raw API response instead of the results array.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
System.Management.Automation.PSObject
NOTES
AddedInVersion: v1.0.4