Compare inventory items

nextyoyoma
Contributor

When we assigned our computers, we used the Real name and Username fields in the computer record to do so. However, we ended up with a few students getting the wrong computer. Long story short, I need a way to compare the username field to an extension attribute I created to see what user was logged in at last inventory and see if they are the same. I would be open to doing this with an inventory search or by creating an additional extension attribute. The problem is that I don't know of any way to query the JSS database from within a script. Is this possible at all?

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Do you have the Last User Extension Attribute already enabled on your JSS? If so, I would think you could do this with an Advanced Search.

For example, in an Advanced Search, don't add any specific criteria, so it pulls all your managed systems up but adjust your display fields to show User Name (built-in under Location) and Last user (the EA)

With both of these fields being displayed, you should get a rundown of the "User Name" and/or "Real Name" assigned to the Mac as well as the "Last User" that has logged in.
Its not very obvious, but its not necessary to add in criteria in an advanced search. You can leave those out and it acts the same as doing a blank basic search, except you can choose what fields to display.

Or was there something else that I'm missing? Again, you would need that EA to be enabled on your JSS or this won't get you too far.

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

Do you have the Last User Extension Attribute already enabled on your JSS? If so, I would think you could do this with an Advanced Search.

For example, in an Advanced Search, don't add any specific criteria, so it pulls all your managed systems up but adjust your display fields to show User Name (built-in under Location) and Last user (the EA)

With both of these fields being displayed, you should get a rundown of the "User Name" and/or "Real Name" assigned to the Mac as well as the "Last User" that has logged in.
Its not very obvious, but its not necessary to add in criteria in an advanced search. You can leave those out and it acts the same as doing a blank basic search, except you can choose what fields to display.

Or was there something else that I'm missing? Again, you would need that EA to be enabled on your JSS or this won't get you too far.

nextyoyoma
Contributor

I marked this as answered, and the answer is indeed helpful. However, what I really want to do is end up with entries where the two fields are not the same. I could do this in a script if I could retrieve the username (built-in) field assigned to the computer in the JSS from a script. Is that possible?