Skip to content

New-NBImageAttachment

Since

v4.5.2.0

SYNOPSIS

Creates a new image attachment in Netbox.

SYNTAX

New-NBImageAttachment [-Object_Type] <String> [-Object_Id] <UInt64> [-ImagePath] <String> [[-Name] <String>]
 [[-Description] <String>] [-Raw] [-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm]
 [<CommonParameters>]

DESCRIPTION

Uploads an image file and attaches it to a Netbox object. Supports any object type that allows image attachments (devices, sites, racks, rack types, etc.).

EXAMPLES

EXAMPLE 1

New-NBImageAttachment -Object_Type "dcim.racktype" -Object_Id 1 -ImagePath "./rack-front.png"

Attaches rack-front.png to rack type with ID 1.

EXAMPLE 2

New-NBImageAttachment -Object_Type "dcim.device" -Object_Id 42 -ImagePath "/tmp/server.jpg" -Name "Front View" -Description "Server front panel"

Attaches server.jpg to device 42 with a name and description.

EXAMPLE 3

Get-NBDCIMRackType -Name "42U Standard" | New-NBImageAttachment -Object_Type "dcim.racktype" -ImagePath "./elevation.png"

Pipes a rack type and attaches an image to it.

PARAMETERS

-Object_Type

The content type of the object to attach the image to. Format: "app.model" Examples: dcim.device, dcim.site, dcim.rack, dcim.racktype, dcim.devicetype

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Object_Id

The database ID of the object to attach the image to.

Type: UInt64
Parameter Sets: (All)
Aliases: Id

Required: True
Position: 2
Default value: 0
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ImagePath

Path to the image file to upload. Supports common image formats (PNG, JPG, GIF, etc.).

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Name

Optional name for the image attachment. Maximum 50 characters.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

Optional description for the image attachment. Maximum 200 characters.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Raw

Return the raw API response.

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: v4.5.2.0

Common parameters

common request params

https://netbox.readthedocs.io/en/stable/rest-api/overview/