This query usually returns a single computer id, but occasionally I get this result:
> <BESAPI xsi:noNamespaceSchemaLocation="BESAPI.xsd">
> <Query Resource="ids of bes computers whose ("Client Mac Address" of it as string contains "xx-xx-xx-xx-xx-xx")">
> <Result/>
> <Evaluation><Time>3.901ms</Time>
> <Plurality>Plural</Plurality>
> </Evaluation>
> </Query>
> </BESAPI>
I’ve also tried “unique values of” and “maximum of ids”, but get the same result. How can I improve this so that I always get a single computer id?
That’s not just “plural” as a result, that’s NO results with a data type of “plural”. The problem seems to be that the given MAC address is not found.
You might try checking for case-sensitivity on the MAC address query?
Ah, ok thanks. Still getting used to interpreting the responses. I thought it might be case sensitive, so I copied and pasted from a response to a computer query:
<Property Name="ID">11233520</Property>
<Property Name="Client Mac Address">yy-yy-yy-yy-yy-yy</Property>
<Property Name="Client Mac Address">zz-zz-zz-zz-zz-zz</Property>
<Property Name="Client Mac Address">xx-xx-xx-xx-xx-xx</Property>
<Property Name="Client Mac Address">xy-xy-xy-xy-xy-xy</Property>
I know there is a computer with this value, but this query isn’t showing it for some reason
Have you gotten a result for that from any query? I’m wondering whether it’s maybe selecting one result from a computer posting multiple results for MAC address.
I don’t have a console handy as I’m offsite this week, but I think you might need something along the lines of
whose (exists "Client Mac Address" whose (it as string contains "xx-xx-xx") of it)
or maybe even
ids of bes computers whose (exists values whose (it as string as lowercase contains "xx-xx-xx" as lowercase) of results of properties whose (name of it = "Client Mac Address") of it)
yes, I get results most of the time. 1 out of every 150 or so comes back empty
id of bes computer whose(exists values whose("xx-xx-xx-xx-xx-xx" as lowercase = it as lowercase) of results from (bes property whose(name of it = "Client Mac Address")) of it)
This works, but takes 45 seconds to return a result. Scouring multiple properties for a mac address isn’t the most efficient but 45 seconds seems like a little much. is there a faster way?
I don’t have a console in front of me, but maybe something like
ids of computers of results whose (value of it as string as lowercase = "xx-xx-xx" as lowercase) of bes property "Client Mac Address"
or
ids of computers of results whose (value of it as string as lowercase = "xx-xx-xx" as lowercase) of bes properties whose (name of it = "Client Mac Address")
If the MAC addresses are all actually reporting in lowercase (which I’m not sure is true) you could skip casting “as lowercase”, and doing a “=” comparison should be faster than “contains”