mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-16 19:25:47 +00:00
Merge 00cdedbbab into 7129e7d3c7
This commit is contained in:
commit
2fef45b0e1
2 changed files with 59 additions and 48 deletions
|
|
@ -14,6 +14,8 @@ function Set-NetboxIPAMAddress {
|
|||
|
||||
[uint64]$Tenant,
|
||||
|
||||
[uint64][]$Tags,
|
||||
|
||||
[uint64]$VRF,
|
||||
|
||||
[object]$Role,
|
||||
|
|
|
|||
|
|
@ -333,16 +333,25 @@ function BuildNewURI {
|
|||
|
||||
Write-Verbose " URIPath: $($uriBuilder.Path)"
|
||||
|
||||
if ($parameters) {
|
||||
if ($Parameters) {
|
||||
# Loop through the parameters and use the HttpUtility to create a Query string
|
||||
[System.Collections.Specialized.NameValueCollection]$URIParams = [System.Web.HttpUtility]::ParseQueryString([String]::Empty)
|
||||
[System.Collections.Specialized.NameValueCollection]$URIParams = [System.Web.HttpUtility]::ParseQueryString($uriBuilder.Query)
|
||||
|
||||
foreach ($param in $Parameters.GetEnumerator()) {
|
||||
Write-Verbose " Adding URI parameter $($param.Key):$($param.Value)"
|
||||
if ($param.Key -eq 'q') {
|
||||
# Append the query string directly
|
||||
$uriBuilder.Query = $uriBuilder.Query.TrimStart('?') + '&' + $param.Value
|
||||
}
|
||||
else {
|
||||
$URIParams[$param.Key] = $param.Value
|
||||
}
|
||||
}
|
||||
|
||||
$uriBuilder.Query = $URIParams.ToString()
|
||||
# Combine the existing query with new parameters
|
||||
$existingQuery = $uriBuilder.Query.TrimStart('?')
|
||||
$newQuery = $URIParams.ToString()
|
||||
$uriBuilder.Query = ($existingQuery + '&' + $newQuery).Trim('&')
|
||||
}
|
||||
|
||||
Write-Verbose " Completed building URIBuilder"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue