Connect-NBAPI
Since
v1.0.4
SYNOPSIS
Connects to the Netbox API and ensures Credential work properly
SYNTAX
Manual (Default)
Connect-NBAPI -Hostname <String> [-Credential <PSCredential>] [-Scheme <String>] [-Port <UInt16>]
[-SkipCertificateCheck] [-TimeoutSeconds <UInt16>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
URI
Connect-NBAPI [-Credential <PSCredential>] -URI <String> [-SkipCertificateCheck] [-TimeoutSeconds <UInt16>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
DESCRIPTION
Connects to the Netbox API and ensures Credential work properly
EXAMPLES
EXAMPLE 1
Connect-NBAPI -Hostname "netbox.domain.com"
This will prompt for Credential, then proceed to attempt a connection to Netbox
PARAMETERS
-Hostname
The hostname for the resource such as netbox.domain.com
```yaml Type: String Parameter Sets: Manual Aliases:
Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Credential
A PSCredential object. Put the API token in the Password field. The Username field is ignored.
Supports both token formats: - v1 (legacy): 40-character hex token, uses 'Token' auth header - v2 (4.5+): Starts with 'nbt_', uses 'Bearer' auth header
The correct auth header is automatically detected based on token format.
Example: $cred = [PSCredential]::new('api', (ConvertTo-SecureString 'your-api-token' -AsPlainText -Force))
```yaml Type: PSCredential Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-Scheme
Scheme for the URI such as HTTP or HTTPS. Defaults to HTTPS
```yaml Type: String Parameter Sets: Manual Aliases:
Required: False Position: Named Default value: Https Accept pipeline input: False Accept wildcard characters: False ```
-Port
Port for the resource. Value between 1-65535
```yaml Type: UInt16 Parameter Sets: Manual Aliases:
Required: False Position: Named Default value: 443 Accept pipeline input: False Accept wildcard characters: False ```
-URI
The full URI for the resource such as "https://netbox.domain.com:8443"
```yaml Type: String Parameter Sets: URI Aliases:
Required: True Position: Named Default value: None Accept pipeline input: False Accept wildcard characters: False ```
-SkipCertificateCheck
Skip SSL/TLS certificate validation. Use this for self-signed certificates or test environments. On PowerShell Core (7+), uses the native -SkipCertificateCheck parameter. On PowerShell Desktop (5.1), uses a custom certificate policy callback.
```yaml Type: SwitchParameter Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: False Accept pipeline input: False Accept wildcard characters: False ```
-TimeoutSeconds
The number of seconds before the HTTP call times out. Defaults to 30 seconds
```yaml Type: UInt16 Parameter Sets: (All) Aliases:
Required: False Position: Named Default value: 30 Accept pipeline input: False Accept wildcard characters: False ```
-ProgressAction
{{ Fill ProgressAction Description }}
```yaml 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