From b164ffe0b45b7a42e410b1b16723e9e3b3b4a7a3 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:06:00 +0200 Subject: [PATCH 1/9] Connect(Setup): Fix indent (using Visual code Formatter) --- Functions/Setup/Connect-NetboxAPI.ps1 | 61 ++++++++++++++------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/Functions/Setup/Connect-NetboxAPI.ps1 b/Functions/Setup/Connect-NetboxAPI.ps1 index 1b27c12..4244f2a 100644 --- a/Functions/Setup/Connect-NetboxAPI.ps1 +++ b/Functions/Setup/Connect-NetboxAPI.ps1 @@ -1,75 +1,76 @@ function Connect-NetboxAPI { -<# + <# .SYNOPSIS Connects to the Netbox API and ensures Credential work properly - + .DESCRIPTION Connects to the Netbox API and ensures Credential work properly - + .PARAMETER Hostname The hostname for the resource such as netbox.domain.com - + .PARAMETER Credential Credential object containing the API key in the password. Username is not applicable - + .PARAMETER Scheme Scheme for the URI such as HTTP or HTTPS. Defaults to HTTPS - + .PARAMETER Port Port for the resource. Value between 1-65535 - + .PARAMETER URI The full URI for the resource such as "https://netbox.domain.com:8443" - + .EXAMPLE PS C:\> Connect-NetboxAPI -Hostname "netbox.domain.com" - + This will prompt for Credential, then proceed to attempt a connection to Netbox - + .NOTES Additional information about the function. #> - + [CmdletBinding(DefaultParameterSetName = 'Manual')] param ( [Parameter(ParameterSetName = 'Manual', Mandatory = $true)] [string]$Hostname, - + [Parameter(Mandatory = $false)] [pscredential]$Credential, - + [Parameter(ParameterSetName = 'Manual')] [ValidateSet('https', 'http', IgnoreCase = $true)] [string]$Scheme = 'https', - + [Parameter(ParameterSetName = 'Manual')] [uint16]$Port = 443, - + [Parameter(ParameterSetName = 'URI', Mandatory = $true)] [string]$URI ) - + if (-not $Credential) { try { $Credential = Get-NetboxCredential -ErrorAction Stop - } catch { + } + catch { # Credentials are not set... Try to obtain from the user if (-not ($Credential = Get-Credential -UserName 'username-not-applicable' -Message "Enter token for Netbox")) { throw "Token is necessary to connect to a Netbox API." } } } - + $null = Set-NetboxCredential -Credential $Credential - + switch ($PSCmdlet.ParameterSetName) { 'Manual' { $uriBuilder = [System.UriBuilder]::new($Scheme, $Hostname, $Port) } - + 'URI' { $uriBuilder = [System.UriBuilder]::new($URI) if ([string]::IsNullOrWhiteSpace($uriBuilder.Host)) { @@ -77,35 +78,37 @@ } } } - + $null = Set-NetboxHostName -Hostname $uriBuilder.Host $null = Set-NetboxHostScheme -Scheme $uriBuilder.Scheme $null = Set-NetboxHostPort -Port $uriBuilder.Port - + try { Write-Verbose "Verifying API connectivity..." $null = VerifyAPIConnectivity - } catch { + } + catch { Write-Verbose "Failed to connect. Generating error" Write-Verbose $_.Exception.Message if (($_.Exception.Response) -and ($_.Exception.Response.StatusCode -eq 403)) { throw "Invalid token" - } else { + } + else { throw $_ } } - + Write-Verbose "Caching API definition" $script:NetboxConfig.APIDefinition = Get-NetboxAPIDefinition - + if ([version]$script:NetboxConfig.APIDefinition.info.version -lt 2.8) { $Script:NetboxConfig.Connected = $false throw "Netbox version is incompatible with this PS module. Requires >=2.8.*, found version $($script:NetboxConfig.APIDefinition.info.version)" } - + $script:NetboxConfig.Connected = $true Write-Verbose "Successfully connected!" - + #Write-Verbose "Caching static choices" #$script:NetboxConfig.Choices.Circuits = Get-NetboxCircuitsChoices #$script:NetboxConfig.Choices.DCIM = Get-NetboxDCIMChoices # Not completed yet @@ -114,6 +117,6 @@ ##$script:NetboxConfig.Choices.Secrets = Get-NetboxSecretsChoices # Not completed yet ##$script:NetboxConfig.Choices.Tenancy = Get-NetboxTenancyChoices #$script:NetboxConfig.Choices.Virtualization = Get-NetboxVirtualizationChoices - + Write-Verbose "Connection process completed" } \ No newline at end of file From 5b1ee457690fd7a98b9e56ed3c3b3f70dae0756b Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:19:45 +0200 Subject: [PATCH 2/9] Setup(Functions): Fix indent (using Visual Code Formatter) --- Functions/Setup/Get-NetboxCredential.ps1 | 4 ++-- Functions/Setup/Get-NetboxHostname.ps1 | 4 ++-- Functions/Setup/Set-NetboxCredential.ps1 | 16 ++++++++-------- Functions/Setup/Set-NetboxHostName.ps1 | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Functions/Setup/Get-NetboxCredential.ps1 b/Functions/Setup/Get-NetboxCredential.ps1 index 25f0eb9..a1235fb 100644 --- a/Functions/Setup/Get-NetboxCredential.ps1 +++ b/Functions/Setup/Get-NetboxCredential.ps1 @@ -2,10 +2,10 @@ [CmdletBinding()] [OutputType([pscredential])] param () - + if (-not $script:NetboxConfig.Credential) { throw "Netbox Credentials not set! You may set with Set-NetboxCredential" } - + $script:NetboxConfig.Credential } \ No newline at end of file diff --git a/Functions/Setup/Get-NetboxHostname.ps1 b/Functions/Setup/Get-NetboxHostname.ps1 index 0629541..63a8c3f 100644 --- a/Functions/Setup/Get-NetboxHostname.ps1 +++ b/Functions/Setup/Get-NetboxHostname.ps1 @@ -1,11 +1,11 @@ function Get-NetboxHostname { [CmdletBinding()] param () - + Write-Verbose "Getting Netbox hostname" if ($null -eq $script:NetboxConfig.Hostname) { throw "Netbox Hostname is not set! You may set it with Set-NetboxHostname -Hostname 'hostname.domain.tld'" } - + $script:NetboxConfig.Hostname } \ No newline at end of file diff --git a/Functions/Setup/Set-NetboxCredential.ps1 b/Functions/Setup/Set-NetboxCredential.ps1 index 448f272..dcbb24a 100644 --- a/Functions/Setup/Set-NetboxCredential.ps1 +++ b/Functions/Setup/Set-NetboxCredential.ps1 @@ -1,32 +1,32 @@ function Set-NetboxCredential { [CmdletBinding(DefaultParameterSetName = 'CredsObject', - ConfirmImpact = 'Low', - SupportsShouldProcess = $true)] + ConfirmImpact = 'Low', + SupportsShouldProcess = $true)] [OutputType([pscredential])] param ( [Parameter(ParameterSetName = 'CredsObject', - Mandatory = $true)] + Mandatory = $true)] [pscredential]$Credential, - + [Parameter(ParameterSetName = 'UserPass', - Mandatory = $true)] + Mandatory = $true)] [securestring]$Token ) - + if ($PSCmdlet.ShouldProcess('Netbox Credentials', 'Set')) { switch ($PsCmdlet.ParameterSetName) { 'CredsObject' { $script:NetboxConfig.Credential = $Credential break } - + 'UserPass' { $script:NetboxConfig.Credential = [System.Management.Automation.PSCredential]::new('notapplicable', $Token) break } } - + $script:NetboxConfig.Credential } } \ No newline at end of file diff --git a/Functions/Setup/Set-NetboxHostName.ps1 b/Functions/Setup/Set-NetboxHostName.ps1 index 92b9dbe..a70c055 100644 --- a/Functions/Setup/Set-NetboxHostName.ps1 +++ b/Functions/Setup/Set-NetboxHostName.ps1 @@ -1,13 +1,13 @@ function Set-NetboxHostName { [CmdletBinding(ConfirmImpact = 'Low', - SupportsShouldProcess = $true)] + SupportsShouldProcess = $true)] [OutputType([string])] param ( [Parameter(Mandatory = $true)] [string]$Hostname ) - + if ($PSCmdlet.ShouldProcess('Netbox Hostname', 'Set')) { $script:NetboxConfig.Hostname = $Hostname.Trim() $script:NetboxConfig.Hostname From 4ad05624662b8380d40fa4ff6aaee5e426f94d0d Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:22:28 +0200 Subject: [PATCH 3/9] Support(Setup): Fix indent (using Visual Code Formatter) --- .../Setup/Support/Get-NetboxAPIDefinition.ps1 | 26 +++++++++---------- .../Support/SetupNetboxConfigVariable.ps1 | 8 +++--- .../Setup/Support/VerifyAPIConnectivity.ps1 | 8 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 b/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 index 3fb0215..21315c8 100644 --- a/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 +++ b/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 @@ -1,4 +1,4 @@ -<# +<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.174 @@ -14,16 +14,16 @@ function Get-NetboxAPIDefinition { - [CmdletBinding()] - param () - - #$URI = "https://netbox.neonet.org/api/docs/?format=openapi" - - $Segments = [System.Collections.ArrayList]::new(@('docs')) - - $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{'format' = 'openapi'} - - $URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck - - InvokeNetboxRequest -URI $URI -Timeout 10 + [CmdletBinding()] + param () + + #$URI = "https://netbox.neonet.org/api/docs/?format=openapi" + + $Segments = [System.Collections.ArrayList]::new(@('docs')) + + $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{'format' = 'openapi' } + + $URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck + + InvokeNetboxRequest -URI $URI -Timeout 10 } diff --git a/Functions/Setup/Support/SetupNetboxConfigVariable.ps1 b/Functions/Setup/Support/SetupNetboxConfigVariable.ps1 index 20d84a8..a8ac41f 100644 --- a/Functions/Setup/Support/SetupNetboxConfigVariable.ps1 +++ b/Functions/Setup/Support/SetupNetboxConfigVariable.ps1 @@ -4,17 +4,17 @@ ( [switch]$Overwrite ) - + Write-Verbose "Checking for NetboxConfig hashtable" if ((-not ($script:NetboxConfig)) -or $Overwrite) { Write-Verbose "Creating NetboxConfig hashtable" $script:NetboxConfig = @{ - 'Connected' = $false - 'Choices' = @{ + 'Connected' = $false + 'Choices' = @{ } 'APIDefinition' = $null } } - + Write-Verbose "NetboxConfig hashtable already exists" } \ No newline at end of file diff --git a/Functions/Setup/Support/VerifyAPIConnectivity.ps1 b/Functions/Setup/Support/VerifyAPIConnectivity.ps1 index b53760e..fb8d9d1 100644 --- a/Functions/Setup/Support/VerifyAPIConnectivity.ps1 +++ b/Functions/Setup/Support/VerifyAPIConnectivity.ps1 @@ -1,10 +1,10 @@ function VerifyAPIConnectivity { [CmdletBinding()] param () - + $uriSegments = [System.Collections.ArrayList]::new(@('extras')) - - $uri = BuildNewURI -Segments $uriSegments -Parameters @{'format' = 'json'} -SkipConnectedCheck - + + $uri = BuildNewURI -Segments $uriSegments -Parameters @{'format' = 'json' } -SkipConnectedCheck + InvokeNetboxRequest -URI $uri } \ No newline at end of file From 2bf4ed6f6fc482ba694c6d41daf5dcfdf65fd9b4 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:22:59 +0200 Subject: [PATCH 4/9] InvokeNetboxRequest(Helpers): Fix indent (using Visual Code Formatter) --- Functions/Helpers/InvokeNetboxRequest.ps1 | 54 ++++++++++++----------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/Functions/Helpers/InvokeNetboxRequest.ps1 b/Functions/Helpers/InvokeNetboxRequest.ps1 index ef5d31e..d5c55f6 100644 --- a/Functions/Helpers/InvokeNetboxRequest.ps1 +++ b/Functions/Helpers/InvokeNetboxRequest.ps1 @@ -1,4 +1,4 @@ -<# +<# .NOTES =========================================================================== Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 @@ -18,44 +18,44 @@ function InvokeNetboxRequest { ( [Parameter(Mandatory = $true)] [System.UriBuilder]$URI, - + [Hashtable]$Headers = @{ }, - + [pscustomobject]$Body = $null, - + [ValidateRange(0, 60)] [uint16]$Timeout = 5, - + [ValidateSet('GET', 'PATCH', 'PUT', 'POST', 'DELETE', 'OPTIONS', IgnoreCase = $true)] [string]$Method = 'GET', - + [switch]$Raw ) - + $creds = Get-NetboxCredential - + $Headers.Authorization = "Token {0}" -f $creds.GetNetworkCredential().Password - + $splat = @{ - 'Method' = $Method - 'Uri' = $URI.Uri.AbsoluteUri # This property auto generates the scheme, hostname, path, and query - 'Headers' = $Headers - 'TimeoutSec' = $Timeout + 'Method' = $Method + 'Uri' = $URI.Uri.AbsoluteUri # This property auto generates the scheme, hostname, path, and query + 'Headers' = $Headers + 'TimeoutSec' = $Timeout 'ContentType' = 'application/json' 'ErrorAction' = 'Stop' - 'Verbose' = $VerbosePreference + 'Verbose' = $VerbosePreference } - + if ($Body) { Write-Verbose "BODY: $($Body | ConvertTo-Json -Compress)" $null = $splat.Add('Body', ($Body | ConvertTo-Json -Compress)) } - + $result = Invoke-RestMethod @splat - + #region TODO: Handle errors a little more gracefully... - + <# try { Write-Verbose "Sending request..." @@ -69,7 +69,7 @@ function InvokeNetboxRequest { Write-Verbose "RAW provided...throwing raw exception" throw $_ } - + Write-Verbose "Converting response to object" $myError = GetNetboxAPIErrorBody -Response $_.Exception.Response | ConvertFrom-Json } else { @@ -77,27 +77,29 @@ function InvokeNetboxRequest { $myError = $_ } } - + Write-Verbose "MyError is $($myError.GetType().FullName)" - + if ($myError -is [Exception]) { throw $_ } elseif ($myError -is [pscustomobject]) { throw $myError.detail - } + } #> - + #endregion TODO: Handle errors a little more gracefully... - + # If the user wants the raw value from the API... otherwise return only the actual result if ($Raw) { Write-Verbose "Returning raw result by choice" return $result - } else { + } + else { if ($result.psobject.Properties.Name.Contains('results')) { Write-Verbose "Found Results property on data, returning results directly" return $result.Results - } else { + } + else { Write-Verbose "Did NOT find results property on data, returning raw result" return $result } From c8c6d48ee44026d3d610bc578f7833e63a6299d7 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:35:39 +0200 Subject: [PATCH 5/9] Add Set-netboxCipherSSL for enable TLS1.1 and TLS1.2 (for PS 5.0) From PowerAruba/FortiPower Module :) --- Functions/Setup/Set-NetboxCipherSSL.ps1 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Functions/Setup/Set-NetboxCipherSSL.ps1 diff --git a/Functions/Setup/Set-NetboxCipherSSL.ps1 b/Functions/Setup/Set-NetboxCipherSSL.ps1 new file mode 100644 index 0000000..bad4402 --- /dev/null +++ b/Functions/Setup/Set-NetboxCipherSSL.ps1 @@ -0,0 +1,8 @@ +Function Set-NetboxCipherSSL { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessforStateChangingFunctions", "")] + Param( ) + # Hack for allowing TLS 1.1 and TLS 1.2 (by default it is only SSL3 and TLS (1.0)) + $AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12' + [System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols + +} \ No newline at end of file From c8233ab57243902ef7a2af7222765e2dd03c2707 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:36:39 +0200 Subject: [PATCH 6/9] Add Set-NetboxUnstrustedSSL for disable SSL chain test (for PS 5.0 From PowerAruba/FortiPwoer Module :) --- Functions/Setup/Set-NetboxUnstrustedSSL.ps1 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Functions/Setup/Set-NetboxUnstrustedSSL.ps1 diff --git a/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 b/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 new file mode 100644 index 0000000..e118d1c --- /dev/null +++ b/Functions/Setup/Set-NetboxUnstrustedSSL.ps1 @@ -0,0 +1,19 @@ +Function Set-NetboxUntrustedSSL { + [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessforStateChangingFunctions", "")] + Param( ) + # Hack for allowing untrusted SSL certs with https connections + Add-Type -TypeDefinition @" + using System.Net; + using System.Security.Cryptography.X509Certificates; + public class TrustAllCertsPolicy : ICertificatePolicy { + public bool CheckValidationResult( + ServicePoint srvPoint, X509Certificate certificate, + WebRequest request, int certificateProblem) { + return true; + } + } +"@ + + [System.Net.ServicePointManager]::CertificatePolicy = New-Object -TypeName TrustAllCertsPolicy + +} \ No newline at end of file From 254a2798ac872ede6152461afe70ad1aad3dfcb3 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 22:41:26 +0200 Subject: [PATCH 7/9] Add Get/Set netboxInvokeParms for Get and Set Invoke Params (array) Like -SkipCertificate, Timeout... --- Functions/Setup/Get-NetboxInvokeParams.ps1 | 11 +++++++++++ Functions/Setup/Set-NetboxInvokeParams.ps1 | 15 +++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 Functions/Setup/Get-NetboxInvokeParams.ps1 create mode 100644 Functions/Setup/Set-NetboxInvokeParams.ps1 diff --git a/Functions/Setup/Get-NetboxInvokeParams.ps1 b/Functions/Setup/Get-NetboxInvokeParams.ps1 new file mode 100644 index 0000000..0cd33c7 --- /dev/null +++ b/Functions/Setup/Get-NetboxInvokeParams.ps1 @@ -0,0 +1,11 @@ +function Get-NetboxInvokeParams { + [CmdletBinding()] + param () + + Write-Verbose "Getting Netbox InvokeParams" + if ($null -eq $script:NetboxConfig.InvokeParams) { + throw "Netbox Invoke Parms is not set! You may set it with Set-NetboxInvokeParams -InvokeParams ..." + } + + $script:NetboxConfig.InvokeParams +} \ No newline at end of file diff --git a/Functions/Setup/Set-NetboxInvokeParams.ps1 b/Functions/Setup/Set-NetboxInvokeParams.ps1 new file mode 100644 index 0000000..ca5dbf5 --- /dev/null +++ b/Functions/Setup/Set-NetboxInvokeParams.ps1 @@ -0,0 +1,15 @@ +function Set-NetboxInvokeParams { + [CmdletBinding(ConfirmImpact = 'Low', + SupportsShouldProcess = $true)] + [OutputType([string])] + param + ( + [Parameter(Mandatory = $true)] + [array]$InvokeParams + ) + + if ($PSCmdlet.ShouldProcess('Netbox Invoke Params', 'Set')) { + $script:NetboxConfig.InvokeParams = $InvokeParams + $script:NetboxConfig.InvokeParams + } +} \ No newline at end of file From 1a2484db2c0a7c7eed7ae095166208de0b287900 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 23:00:59 +0200 Subject: [PATCH 8/9] InvokeNetboxRequest: Add to Splat NetboxInvokeParams --- Functions/Helpers/InvokeNetboxRequest.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Functions/Helpers/InvokeNetboxRequest.ps1 b/Functions/Helpers/InvokeNetboxRequest.ps1 index d5c55f6..9a82048 100644 --- a/Functions/Helpers/InvokeNetboxRequest.ps1 +++ b/Functions/Helpers/InvokeNetboxRequest.ps1 @@ -47,6 +47,8 @@ function InvokeNetboxRequest { 'Verbose' = $VerbosePreference } + $splat += Get-NetboxInvokeParams + if ($Body) { Write-Verbose "BODY: $($Body | ConvertTo-Json -Compress)" $null = $splat.Add('Body', ($Body | ConvertTo-Json -Compress)) From 4800cc6564a2ef1889f70c73b2331c8a4c6ab0b9 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Wed, 21 Jul 2021 23:02:18 +0200 Subject: [PATCH 9/9] Connect: Add SkipCertificateCheck parameter (for PS5 and Core) Also enable TLS 1.1 and 1.2 for PS5 --- Functions/Setup/Connect-NetboxAPI.ps1 | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Functions/Setup/Connect-NetboxAPI.ps1 b/Functions/Setup/Connect-NetboxAPI.ps1 index 4244f2a..6bc0d03 100644 --- a/Functions/Setup/Connect-NetboxAPI.ps1 +++ b/Functions/Setup/Connect-NetboxAPI.ps1 @@ -49,7 +49,10 @@ [Parameter(ParameterSetName = 'URI', Mandatory = $true)] - [string]$URI + [string]$URI, + + [Parameter(Mandatory = $false)] + [switch]$SkipCertificateCheck = $false ) if (-not $Credential) { @@ -64,7 +67,22 @@ } } - $null = Set-NetboxCredential -Credential $Credential + $invokeParams = @{ SkipCertificateCheck = $SkipCertificateCheck; } + + if ("Desktop" -eq $PSVersionTable.PsEdition) { + #Remove -SkipCertificateCheck from Invoke Parameter (not supported <= PS 5) + $invokeParams.remove("SkipCertificateCheck") + } + + #for PowerShell (<=) 5 (Desktop), Enable TLS 1.1, 1.2 and Disable SSL chain trust + if ("Desktop" -eq $PSVersionTable.PsEdition) { + #Enable TLS 1.1 and 1.2 + Set-NetboxCipherSSL + if ($SkipCertificateCheck) { + #Disable SSL chain trust... + Set-NetboxuntrustedSSL + } + } switch ($PSCmdlet.ParameterSetName) { 'Manual' { @@ -80,8 +98,10 @@ } $null = Set-NetboxHostName -Hostname $uriBuilder.Host + $null = Set-NetboxCredential -Credential $Credential $null = Set-NetboxHostScheme -Scheme $uriBuilder.Scheme $null = Set-NetboxHostPort -Port $uriBuilder.Port + $null = Set-NetboxInvokeParams -invokeParams $invokeParams try { Write-Verbose "Verifying API connectivity..."