New-NBIPAMPrefix
Since
v1.0.4
SYNOPSIS
Creates one or more prefixes in Netbox IPAM module.
SYNTAX
Single (Default)
New-NBIPAMPrefix -Prefix <String> [-Status <String>] [-Tenant <UInt64>] [-Role <UInt64>] [-IsPool <Boolean>]
[-Description <String>] [-Scope_Type <String>] [-Scope_Id <UInt64>] [-VRF <UInt64>] [-VLAN <UInt64>]
[-Custom_Fields <Hashtable>] [-Owner <UInt64>] [-Tags <Object[]>] [-Raw] [-ProgressAction <ActionPreference>]
[-WhatIf] [-Confirm] [<CommonParameters>]
Bulk
New-NBIPAMPrefix -InputObject <PSObject> [-BatchSize <Int32>] [-Force] [-Tags <Object[]>] [-Raw]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
Creates new IP prefixes in Netbox IPAM module. Supports both single prefix creation with individual parameters and bulk creation via pipeline input.
For bulk operations, use the -BatchSize parameter to control how many prefixes are sent per API request. This significantly improves performance when creating many prefixes.
EXAMPLES
EXAMPLE 1
New-NBIPAMPrefix -Prefix "10.0.0.0/24" -Status "active" -Scope_Type "dcim.site" -Scope_Id 1
Creates a single prefix scoped to site ID 1.
EXAMPLE 2
New-NBIPAMPrefix -Prefix "10.0.0.0/24" -Scope_Type "dcim.location" -Scope_Id 5
Creates a prefix scoped to location ID 5.
EXAMPLE 3
$prefixes = 1..50 | ForEach-Object {
[PSCustomObject]@{Prefix="10.$_.0.0/24"; Status="active"; Scope_Type="dcim.site"; Scope_Id=1}
}
$prefixes | New-NBIPAMPrefix -BatchSize 50 -Force
Creates 50 prefixes in bulk using a single API call.
EXAMPLE 4
Import-Csv subnets.csv | New-NBIPAMPrefix -BatchSize 100 -Force
Bulk import prefixes from CSV file.
PARAMETERS
-Prefix
The IP prefix in CIDR notation (e.g., '10.0.0.0/24').
Type: String
Parameter Sets: Single
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Status
Status of the prefix. Defaults to 'Active'.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: Active
Accept pipeline input: False
Accept wildcard characters: False
-Tenant
The tenant ID for the prefix.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-Role
The role ID for the prefix.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-IsPool
Whether this prefix is a pool from which child prefixes can be allocated.
Type: Boolean
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Description
A description of the prefix.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Scope_Type
The scope type for this prefix. Defines what kind of object the prefix is scoped to. Valid values: dcim.region, dcim.sitegroup, dcim.site, dcim.location. Must be used together with -Scope_Id.
Type: String
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Scope_Id
The database ID of the scope object. Must be used together with -Scope_Type.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-VRF
The VRF ID for this prefix.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
-VLAN
The VLAN ID associated with this prefix.
Type: UInt64
Parameter Sets: Single
Aliases:
Required: False
Position: Named
Default value: 0
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: 0
Accept pipeline input: False
Accept wildcard characters: False
-InputObject
Pipeline input for bulk operations. Each object should contain the required property: Prefix.
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 prefixes to create 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 for bulk operations.
Type: SwitchParameter
Parameter Sets: Bulk
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