Skip to main content

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?

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.


Will do. Thanks @mm2270


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>"

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


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