Search for username is Computer Usage Logs?

jsgibson
New Contributor

Is there a way to search for a specific user in the Computer Usage Logs? When this batch of laptops was rolled out (before I got here), not all of them got a proper naming convention (Bob's Macbook Pro.) We have a bunch just named Macbook Pro (37) with no information on the user.

Over the last year and a half, we have fixed these as much as we can, but there are still about 150 that still aren't named correctly. This makes locating a laptop difficult when a student loses one.

Thank you!

1 ACCEPTED SOLUTION

mlawniczak
New Contributor III

Do you use the Extension Attribute to add the Last Logged In User to your inventory? Should help identify who is using the computer.
8d5b98b61cbc4626a2bdfd2ef5fe097b

View solution in original post

7 REPLIES 7

wjc2a
New Contributor

you could use a script to change the machine name to something you can use that unique we use the MAC address this give use a clear thing to search in for jamf pro

!/bin/sh

Get the string that contains the MAC address.

getMac=$(networksetup getmacaddress en0)

Strip the relevant information out and remove the colons.

bareMac=$(echo ${getMac:18:17} | tr -d :)

Switch the MAC address to upper-case to fit in with everything else.

capsMac=$(echo $bareMac | tr '[:lower:]' '[:upper:]')

Set the names.

sudo scutil --set LocalHostName DM$capsMac
sudo scutil --set ComputerName DM$capsMac
sudo scutil --set HostName DM$capsMac

mlawniczak
New Contributor III

Do you use the Extension Attribute to add the Last Logged In User to your inventory? Should help identify who is using the computer.
8d5b98b61cbc4626a2bdfd2ef5fe097b

jsgibson
New Contributor

Those are both really good suggestions. We've been trying to switch to using a unique username for the Computer Name, but the MAC address is a good idea.

I've added the Extension Attribute for Last User and I'm currently trying to make that work. :)

Thank you both!

mlawniczak
New Contributor III

You're welcome and good luck!

jsgibson
New Contributor

I got it all working. Thank you again!

wjc2a
New Contributor

Is their a script for this Extension Attributes?

mm2270
Legendary Contributor III

@wjc2a The "Last User" Extension Attribute is one of the ones in the built in templates in the server. When you go to Extension Attributes, you can choose "New From Template" and then search for "Last User".