Need Help Creating Smart Group - Assigned to User & last user differences

Contributor III

I am trying to create a smart group that looks at the username of who the computer is assigned to, jsmith1 and then looks to see if last user is the same. I want a smart group of computers where they are not the same. I am sure you can see why this is useful, would help find machines assigned incorrectly.

Any one have any ideas?



I think this would be best suited in an extension object by scripting this out and holding a true/false statement as the result; then basing your smart group on said result.

New Contributor III

How are you determining who the computer is assigned to? To find the most recent user I use the following:

#Find most recent user
lastuser=$(ls -t /Users | grep -v "admin" | grep -v "Admin" | grep -v "test" | grep -v "Shared" | grep -v ".localized" | grep -v "Guest" | head -1)

As Geoffrey has mentioned, base a smart group on a comparison of that variable to whomever the computer should be assigned to.