Posted on 12-05-2018 09:35 AM
Hey!
I was wondering if there was a way to check if a group existed on a MacBook?
Like :
If [Group exists]
then ( do this)
else (do nothing)
Is there any quick and easy way to perform this? My scripting skills are still developing so I appreciate any and all help!
Solved! Go to Solution.
Posted on 12-05-2018 10:58 AM
Oh, ok. In that case, there are a few ways.
dscl . list /Groups
The above would list all local groups on the device. You can throw on a grep at the end to look for specific ones if needed.
You can also get details on any group if needed with dscl, but you can also do it with dseditgroup
For example:
dseditgroup -o read admin
Or using dscl:
dscl . read /Groups/admin
Does that help?
Posted on 12-05-2018 09:36 AM
What kind of group are you referring to? Do you mean a Smart Group in Jamf or something else?
Posted on 12-05-2018 10:52 AM
A group on the MacBook itself. Like an admin group or a created group.
Posted on 12-05-2018 10:58 AM
Oh, ok. In that case, there are a few ways.
dscl . list /Groups
The above would list all local groups on the device. You can throw on a grep at the end to look for specific ones if needed.
You can also get details on any group if needed with dscl, but you can also do it with dseditgroup
For example:
dseditgroup -o read admin
Or using dscl:
dscl . read /Groups/admin
Does that help?
Posted on 01-03-2019 07:09 AM
Perfect! Just what I needed!
Thank you!