Skip to main content
Question

Creating Smart Group for number of Local User Accounts


Forum|alt.badge.img+6

I am looking to identify shared computers by creating a smart group that detects more than 4 local user accounts. It is not a sure fire way to know if they are shared but that works for us.

My idea is that the smart computer group criteria is "computers with more than 4 local user accounts"

Is this possible?

5 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • December 8, 2015

Unfortunately, the criteria labeled "Local User Accounts" does not offer a count option. It can only be used to locate machines that have this or that local account on them. I don't think there is a native criteria option for this, so you may need to put together an Extension Attribute, then give it some time for your Macs to submit inventory back to the JSS.
If you need help with an Extension Attribute script for this, just holler.


Forum|alt.badge.img+6
  • Author
  • New Contributor
  • 4 replies
  • December 8, 2015

Will do. Thanks @mm2270


Forum|alt.badge.img+10
  • Contributor
  • 72 replies
  • December 8, 2015

All Local Accounts

#!/bin/sh
echo "<result>$(dscl . list /Users | wc -l | sed 's/^ *//g')</result>"

All Accounts Above 500

#!/bin/sh
echo "<result>$(dscl . list /Users UniqueID | awk '$2>500{print $1}' | wc -l | sed 's/^ *//g')</result>"

Forum|alt.badge.img+9
  • Contributor
  • 29 replies
  • July 16, 2019

I know this is an old thread, but if you've stumbled across it and this is something you'd like to see:

Number of Local Users Searchable Criteria


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • December 6, 2024

Old post, but I've just implemented a solution, based on @matt4836's response. There's now MANY more 'system' accounts, including lots starting with underscores, 'nobody', 'daemon' and 'root'.

In summary:
1. Create a new extension attribute: Settings > Computer management > Extension Attributes > New
Data Type: Integer
Input Type: Script
Paste the following script:

#!/bin/sh echo "<result>$(dscl . list /Users | grep -v '^_' | grep -v 'root' | grep -v 'nobody' | grep -v 'daemon' | wc -l | sed 's/^ *//g')</result>"

 Then Save
2. Create a new smart group to alert on devices where there's more than one user:
Computers > Smart Groups > New

Criteria: [Your Extension Attribute Name] 'more than' 1 > Save 

Hope this helps!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings