Closed WuTangDangie closed 3 years ago
Hi, @WuTangDangie. Thanks for the question. Each call to Get-IBObject
will be its own query (or queries if there are multiple pages of results). So, no. You don't need to make the call with no filter before adding your filter.
It does seem odd that the call with MaxResults returns the result you're looking for with the filter, but including the filter makes it go away. Does the name returned in the results match the filter you're using exactly including capitalization? The WAPI's =
operator is case-sensitive. But that name field also supports using :=
to make it a case-insensitive search. Maybe try this?
Get-IBObject record:host -Filters 'name:=myserver.example.com'
P.S. Here's a quick way to launch the WAPI docs in your default browser for a given object type:
Get-IBSchema record:host -LaunchHTML
Thanks for the quick reply. I assumed that was the case, but wanted to make sure. I did see the : and ~ options, but neither have worked. I verified I have the names correct by going through the gui. In the example below (sanitized a bit) I can find server7 but not server4 (even though I know 1-10 exist). Server7 was in the initial list of MaxResults.
I'll keep poking at it on my side, just wanted to double check that the initial get didn't have to contain all objects.
Thanks.
Out of curiosity, does something like this work?
Get-IBObject record:host -MaxResults 10 | Where-Object { $_.name -eq 'myserver.example.com' }
If that works and the filter still doesn't, then something is definitely weird. If it doesn't, there might be some extra non-visible characters or whitespace in the hostname that is screwing up the comparison.
You might also try something like this to see just the names all right next to each other.
Get-IBObject record:host -MaxResults 10 | Select-Object name
Thanks again for your time. I knew it would be dumb. The user I was using didn't have rights to all the records I needed.
One last thing. Is there a filter for view? Our default is "Internal" which is what I will need 99% of the time so more curious than anything.
Thanks.
Hah, no worries. Permissions issues are always tricky.
There is indeed a filter for view, literally called view
on most of the DNS related objects. Keep in mind that it's another case-sensitive filter but it doesn't support the :=
case-insensitive option. So you can do something like this:
Get-IBObject record:host -Filters 'name:=myserver.example.com','view=Internal'
Do I need to run Get-IBObject -type 'record:host' before I can run Get-IBObject -type 'record:host' -filters 'name=myserver.example.com' ?
If I try Get-IBObject -type 'record:host' -filters 'name=myserver.example.com' I don't return any results. If I run Get-IBObject -type 'record:host' -MaxResults 10 I get 10 records. If I then retry Get-IBObject -type 'record:host' -filters 'name=myserver.example.com' where myserver.example.com was returned in my previous 10 results example it works.
Does that make sense? I'm sure I'm just doing something dumb. Thank you so much for creating this!