The comprehensive PowerShell module for the Netbox REST API with 100% coverage.
Fully compatible with Netbox 4.5.8 (supports 4.3+).
This project is a fork of the original NetboxPS created by Ben Claussen.
We extend our sincere thanks to Ben and all original contributors for building the foundation of this module. Their work made PowerNetbox possible.
| Original Author | Ben Claussen |
| Original Repository | benclaussen/NetboxPS |
| License | MIT (preserved from original) |
- 100% API Coverage - Full support for all Netbox 4.x API endpoints
- Cross-Platform - Works on Windows, Linux, and macOS
- 524 Functions - Complete CRUD operations for all resources
- Pipeline Support - Full PowerShell pipeline integration
- Performance Optimized - Brief mode, field selection, config_context exclusion
- Secure - Token-based authentication (v2
nbt_Bearer) with TLS 1.2/1.3 - Well Tested - ~2166 unit tests + 137 integration tests (94 main + 43 branching)
- Tab Completion - Argument completers for common parameters
- Verbose Logging - Write-Verbose in all functions for debugging
| Module | Endpoints | Functions | Status |
|---|---|---|---|
| DCIM | 43 | 180 | ✅ Full |
| IPAM | 18 | 73 | ✅ Full |
| Virtualization | 4 | 20 | ✅ Full |
| Circuits | 11 | 44 | ✅ Full |
| Tenancy | 5 | 20 | ✅ Full |
| VPN | 10 | 40 | ✅ Full |
| Wireless | 3 | 12 | ✅ Full |
| Extras | 12 | 46 | ✅ Full |
| Core | 5 | 8 | ✅ Full |
| Users | 6 | 24 | ✅ Full |
| Branching* | 4 | 15 | ✅ Full |
* Requires netbox-branching plugin
# Install for current user
Install-Module -Name PowerNetbox -Scope CurrentUser
# Install system-wide (requires admin/root)
Install-Module -Name PowerNetbox -Scope AllUsers# PowerShell 5.1 (Windows PowerShell)
Install-Module -Name PowerNetbox -Scope CurrentUser
# PowerShell 7+ (recommended)
pwsh -Command "Install-Module -Name PowerNetbox -Scope CurrentUser"# Install PowerShell 7 via Homebrew
brew install powershell/tap/powershell
# Install PowerNetbox
pwsh -Command "Install-Module -Name PowerNetbox -Scope CurrentUser"# Install PowerShell 7
sudo apt-get update
sudo apt-get install -y wget apt-transport-https software-properties-common
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install -y powershell
# Install PowerNetbox
pwsh -Command "Install-Module -Name PowerNetbox -Scope CurrentUser"# Clone the repository
git clone https://github.com/ctrl-alt-automate/PowerNetbox.git
cd PowerNetbox
# Build the module
./deploy.ps1 -Environment prod -SkipVersion
# Import the module
Import-Module ./PowerNetbox/PowerNetbox.psd1# Import the module
Import-Module PowerNetbox
# Connect with API token
$credential = Get-Credential -UserName 'api' -Message 'Enter your Netbox API token'
Connect-NBAPI -Hostname 'netbox.example.com' -Credential $credential
# Or connect with self-signed certificate
Connect-NBAPI -Hostname 'netbox.local' -Credential $credential -SkipCertificateCheck# Get all devices (config_context excluded by default for performance)
Get-NBDCIMDevice
# Get a specific device by name
Get-NBDCIMDevice -Name 'server01'
# Create a new IP address
New-NBIPAMAddress -Address '10.0.0.1/24' -Description 'Web Server'
# Update a device
Set-NBDCIMDevice -Id 1 -Description 'Updated description'
# Delete a device (with confirmation)
Remove-NBDCIMDevice -Id 1
# Pipeline support
Get-NBDCIMDevice -Name 'server*' | Set-NBDCIMDevice -Status 'active'PowerNetbox implements NetBox REST API best practices for optimal performance:
# Brief mode - minimal response (~90% smaller payload)
# Returns only: id, url, display, name
Get-NBDCIMDevice -Brief
# Field selection - request only the fields you need
Get-NBDCIMDevice -Fields 'id','name','status','site.name'
# Config context is excluded by default (10-100x faster)
# Include it explicitly when needed:
Get-NBDCIMDevice -IncludeConfigContext
# Combine with filters for best performance
Get-NBDCIMDevice -Site_Id 1 -Status 'active' -Brief| Parameter | Effect | Use Case |
|---|---|---|
-Brief |
~90% smaller response | Dropdowns, reference lists |
-Fields |
Custom field selection | Reports, specific data needs |
-IncludeConfigContext |
Include config_context | When you need rendered config |
Note: The
-Queryparameter performs a broad search and can be slow on large datasets. Use specific filters like-Name,-Site_Id, etc. for better performance.
# Create a VM with interface and IP
$vm = New-NBVirtualMachine -Name 'web-server-01' -Cluster 1 -Status 'active'
$interface = New-NBVirtualMachineInterface -Name 'eth0' -Virtual_Machine $vm.id
$ip = New-NBIPAMAddress -Address '192.168.1.100/24'
Set-NBIPAMAddress -Id $ip.id -Assigned_Object_Type 'virtualization.vminterface' -Assigned_Object_Id $interface.id
# Bulk operations with pipeline
Import-Csv devices.csv | ForEach-Object {
New-NBDCIMDevice -Name $_.Name -Device_Type $_.Type -Site $_.Site
}
# Query with filters
Get-NBIPAMAddress -Status 'active' -Tenant 1 -Limit 100PowerNetbox supports the netbox-branching plugin for staging changes:
# Check if branching is available
Test-NBBranchingAvailable
# Create a new branch
New-NBBranch -Name "feature/new-datacenter" -Description "Planning new DC"
# Enter branch context - all subsequent operations work in this branch
Enter-NBBranch -Name "feature/new-datacenter"
New-NBDCIMSite -Name "DC-New" -Slug "dc-new"
New-NBDCIMDevice -Name "server01" -Role 1 -Device_Type 1 -Site 1
Exit-NBBranch
# Or use Invoke-NBInBranch for exception-safe execution
Invoke-NBInBranch -Branch "staging" -ScriptBlock {
Set-NBDCIMDevice -Id 1 -Status "planned"
New-NBIPAMAddress -Address "10.0.0.1/24"
}
# Review changes in a branch
Get-NBChangeDiff -Branch_Id 1
# Sync branch with latest main
Sync-NBBranch -Id 1
# Merge changes to main
Merge-NBBranch -Id 1
# Revert a merge if needed
Undo-NBBranchMerge -Id 1If you're migrating from the original NetboxPS or NetboxPSv4 module:
# Remove old module
Remove-Module NetboxPS, NetboxPSv4 -Force -ErrorAction SilentlyContinue
Uninstall-Module NetboxPS, NetboxPSv4 -Force -ErrorAction SilentlyContinue
# Install PowerNetbox
Install-Module -Name PowerNetbox -Scope CurrentUser
# Import new module
Import-Module PowerNetboxAll function names remain the same (Get-NBDCIMDevice, New-NBIPAMAddress, etc.), so your existing scripts should work without modification.
- Documentation - Getting started, examples, and troubleshooting
- Netbox API Docs - Official Netbox API documentation
- GitHub Issues - Report bugs or request features
| Guide | Description |
|---|---|
| Getting Started | Installation and first steps |
| Common Workflows | Bulk import, VMware sync, reporting |
| Bulk Operations | High-performance batch processing |
| DCIM Examples | Sites, devices, racks, cables |
| IPAM Examples | IP addresses, prefixes, VLANs |
| Branching | Stage changes with branching plugin |
| Compatibility | Netbox version support matrix |
| Troubleshooting | Common issues and solutions |
| Document | Description |
|---|---|
| Architecture Overview | Module structure and design |
| Functions by Module | Complete function reference |
| Helper Functions | Internal utilities |
| Platform | Minimum Version |
|---|---|
| PowerShell Desktop | 5.1 |
| PowerShell Core | 7.0+ |
| Netbox | 4.3+ (tested with 4.3.7, 4.4.10, 4.5.8) |
Version Compatibility: See the Compatibility Guide for detailed information about supported Netbox versions and API differences.
| OS | PowerShell 5.1 | PowerShell 7+ |
|---|---|---|
| Windows 10/11 | ✅ | ✅ |
| Windows Server | ✅ | ✅ |
| macOS | N/A | ✅ |
| Linux | N/A | ✅ |
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create a feature branch from
dev - Follow PowerShell Practice and Style Guidelines
- Submit a pull request against the
devbranch
This project is licensed under the MIT License - see the LICENSE file for details.
Original copyright (c) 2018 Ben Claussen. Fork maintained by ctrl-alt-automate.
Full release notes live on GitHub Releases. Only the latest versions are detailed below; older versions are summarised for quick lookup.
- ValidateSet drift tooling -
scripts/Verify-ValidateSetParity.ps1detects drift between PowerNetbox[ValidateSet]decorators and NetBoxchoices.py(weighted scoring, CI-gatable via-FailOnMismatch) - Full
Brief/Fields/Omitmutex rollout -AssertNBMutualExclusiveParamnow enforced on all 122 Get functions (completes PR #397 pilot)
- Netbox 4.5.8 compatibility - no API schema changes; CI matrix updated; pure maintenance release upstream
- 22 new Interface parameters on
New-NBDCIMInterface/ 21 onSet-NBDCIMInterface(#394) - full NetBox Interface API coverage:label,parent,bridge,speed,duplex,mark_connected,wwn,vdcs,poe_mode,poe_type,vlan_group,qinq_svlan,vrf,rf_role,rf_channel,rf_channel_frequency,rf_channel_width,tx_power,primary_mac_address,owner,changelog_message,tags - Q-in-Q Mode support (NetBox 4.2+) with backward-compat translations for existing
Access/Tagged/Tagged Alland legacy numeric codes Brief/Fields/Omitmutual exclusion (#397) -Get-NBDCIMDevice,Get-NBIPAMAddress,Get-NBVPNTunnelnow throw a clearParameterBindingExceptionwhen these flags are combined instead of silently picking one. Breaking change for scripts that combined themGet-NBDCIMInterface -TypeValidateSet drift fix - 104 previously-missing interface types now filterable (100/200/400/800GBASE, 1.6TbE, InfiniBand NDR/XDR, IEEE802.11be)- Reimplementation of community PR #396 by @mkarel with
Co-Authored-Bycredit
- Netbox 4.5.7 compatibility - maintenance release, no schema changes
- New cmdlet
Wait-NBBranch(#383) - blocks until branch reaches target status (defaultready); supportsmerged/archivedtargets; pipeline input fromNew-NBBranch. Solves the'HttpResponseBadRequest' object has no attribute 'schema_name'race when using a branch before provisioning completes - Bug fix: Cable_Profile ValidateSet broken since v4.5.0 (#389) - all 24 values were missing their
single-/trunk-/breakout-prefix; replaced with all 25 real values including newbreakout-1c2p-2c1p. Breaking change but old values were rejected by Netbox anyway - Bug fix:
Get-NBBranch -StatusValidateSet (#385) - replaced non-existentconflictvalue with all 11 realBranchStatusChoices - Diagnostics - 401/403 errors now surface active branch context with troubleshooting hints
| Version | Date | Summary |
|---|---|---|
| v4.5.6.0 | 2026-04-02 | NetBox 4.5.6 compat — 8 new 1.6TE interface types |
| v4.5.4.2 | 2026-03-27 | IPAM AddressRange fixes + security hardening (token redaction, workflow permissions, MaxItems cap, SecureString) |
| v4.5.4.1 | 2026-03-17 | -Label / -Parent query filters; [object[]]$Tags rolled out to 146 New/Set functions |
| v4.5.4.0 | 2026-03-17 | NetBox 4.5.4 compat — 119→208 interface types |
| v4.5.3.2 | 2026-03-16 | DeviceBay depopulation via [Nullable[uint64]] on Installed_Device |
| v4.5.3.1 | 2026-03-05 | Interface -Mode sends API strings; -Untagged_VLAN/-Tagged_VLANs → [uint64] IDs |
| v4.5.3.0 | 2026-03-01 | NetBox 4.5.3 compat — -Owner on CircuitType |
| v4.5.2.2 | 2026-02-28 | IPAM Prefix scope_type/scope_id replaces -Site (NetBox 4.2+ schema) |
| v4.5.2.0 | 2026-02-04 | NetBox 4.5.2 + netbox-docker 4.0.0 (Granian/PG18/Valkey9); -Omit on all 123 Get functions; New-NBImageAttachment added |
- VPN/Wireless Pagination - Added
-Alland-PageSizeparameters to 12 VPN and Wireless Get- functions for automatic pagination (#250)- VPN:
Get-NBVPNTunnel,Get-NBVPNTunnelGroup,Get-NBVPNTunnelTermination,Get-NBVPNIKEPolicy,Get-NBVPNIKEProposal,Get-NBVPNIPSecPolicy,Get-NBVPNIPSecProfile,Get-NBVPNIPSecProposal,Get-NBVPNL2VPN,Get-NBVPNL2VPNTermination - Wireless:
Get-NBWirelessLAN,Get-NBWirelessLANGroup,Get-NBWirelessLink
- VPN:
- Removed Form_Factor Parameter - Removed obsolete
Form_Factorparameter from interface functions (#252)- Removed from
Get-NBDCIMInterface,New-NBDCIMInterface,Set-NBDCIMInterface - Use
-Typeparameter instead (e.g.,1000base-t,virtual,lag)
- Removed from
- Strong Parameter Typing - Added ValidateSet attributes for stricter parameter validation (#248)
- Input Validation - Added URL segment validation in BuildNewURI helper (#247)
- Security Fixes - Verbose logging redacts sensitive fields, SecureString for webhook secrets (#234)
- Bug Fix: PowerShell Core 7.x Error Messages - Fixed issue where API error messages were not displayed correctly in PowerShell Core 7.x (#164)
- Error details now correctly extracted from
ErrorDetails.Message - Fallback to
Exception.Responsefor Windows PowerShell 5.1 compatibility - Improved JSON/HTML error parsing logic
- Error details now correctly extracted from
- Performance Optimization - Implements NetBox REST API best practices
-Briefswitch on all GET functions (~90% smaller responses)-Fieldsparameter for custom field selectionconfig_contextexcluded by default (10-100x faster for device/VM queries)-IncludeConfigContextswitch to opt-in when needed- Warning when using
-Queryparameter (slow on large datasets)
- VPN Function Improvements - Fixed verbose messages and code formatting
- 524 public functions with 100% API coverage
- 1436 unit tests, 98 integration tests
- Full Netbox 4.5.0 compatibility - Tested with official 4.5.0 release
- Token v2 Bearer authentication - Support for new
nbt_<KEY>.<TOKEN>format - Cable Profiles -
Cable_Profileparameter on cable functions - Object Ownership - New
Get/New/Set/Remove-NBOwnerand*-NBOwnerGroupfunctions - Test-NBAuthentication - New function for auth verification
- Port Mappings - Bidirectional
rear_ports/front_portssupport - New fields -
start_on_boot,enabled,coloron various endpoints - Is_Staff deprecation - Automatically handled for User functions
- 506 public functions with 100% API coverage
- 952 unit tests, 94 integration tests
- Full Netbox 4.4.10 compatibility - Tested with latest stable release
- New bridge_interfaces field - Interface API now returns reverse bridge relationships (read-only)
- 498 public functions with 100% API coverage
- Bulk operations resilience - Automatic fallback to sequential requests on 500 errors
- PowerShell 7.4+ compatibility - Fixed redirect handling in
Connect-NBAPI - Pipeline binding fix -
Set-NBIPAMAddressnow accepts Status/Description from pipeline - Scenario test suite - Comprehensive tests for bulk operations, workflows, and filters
- Argument completers - Tab completion for common parameters (#115, #117)
- Verbose logging - Write-Verbose added to all 448 functions (#121)
- Documentation cleanup - Removed placeholder documentation (#116)
- Test suite improvements - Comprehensive integration tests for Circuits, VPN, Wireless, Extras (#128)
- Bug fixes - Bulk mode parameter binding, parameter naming standardization (#118, #120)
- Code quality - PSScriptAnalyzer compliance, quality audit fixes (#126)
- Cross-platform error handling - Fixed type casting error on PowerShell Core 7.x (#100)
- Central version parsing - New
ConvertTo-NetboxVersionhelper for consistent version detection (#111) - Improved compatibility - Handles Docker-suffixed versions like
4.2.9-Docker-3.2.1 - 952 unit tests - Added tests for version parsing and error handling
- Full Netbox 4.4.9 compatibility - Tested with latest stable release
- Docker-based integration testing - 79 live API tests against real Netbox
- 946 unit tests across all platforms
- 494 public functions with 100% API coverage
- Docker-based CI/CD integration testing
- Documentation updates
- New versioning:
Major.Minor.Patch.ModulePatch(first 3 digits = Netbox version) - PowerShell 5.1 compatibility fix for
Remove-NBDCIMSite - SecureString support for password parameters in User functions
- Code quality improvements (OutputType, ValidateNotNullOrEmpty)
- Initial PowerNetbox release (fork of NetboxPS)
- 100% API coverage for Netbox 4.4.8
- 478 public functions across all modules
- 613 unit tests for quality assurance
- Cross-platform support - Windows, Linux, macOS
- New modules: VPN, Wireless, Core, Users
- All function names unchanged for backwards compatibility
