BatmanAMA / powerbox

Netbox powershell module
MIT License
48 stars 18 forks source link

Get-nbIpAddress cannot search with assigned_object_id specified #45

Open AnythingOverIP opened 3 years ago

AnythingOverIP commented 3 years ago

It looks like there is a small bug with Get-nbIpAddress. When using Get-nbIpAddress -query @{assigned_object_id=5137} the result of this query returns all IP addresses contained in Netbox. If I use another query like Get-nbIpAddress -query @{id=17} I receive a single entry which is what's expected.

In the meantime, I do the query offline as a workaround, but it would be nice to leverage the API for a concise query:

$variable = Get-nbIpAddress
$variable | Where-Object {$_.assigned_object_ID -eq 5137}
$psversiontable
Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Microsoft Windows 10.0.19043
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

(Get-Module | Where-Object {$_.Name -eq 'powerbox'}).version

Major  Minor  Build  Revision
-----  -----  -----  --------
2      3      5      -1