Inventory rule to see who is a member of the Local Administrator group
Is there a way for us to see who is part of the local administrators group on devices?
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
PaulGibson
5 years ago
I've got Custom Inventory Rules, for Windows, Linux and Mac. These were setup by the trainer when we purchased KACE.
Local Administrators Listing - Windows (CIF)
ShellCommandTextReturn(cmd /c net localgroup Administrators)
Local Administrators Listing - Linux (CIF)
ShellCommandTextReturn(grep wheel /etc/group | sed 's/^.*:root,//')
Local Administrators Listing - Mac (CIF)
ShellCommandTextReturn(dscl . -read /Groups/admin GroupMembership | sed 's/GroupMembership: root //' | sed 's/ / | /g')
Comments:
-
you need to be language sensitive on windows
If your system is german or italian you need the matching administrators group name
and i would add this to strip the text from result and just list the members
this is for german Windows OS language but you get the idea to strip the text
ShellCommandTextReturn(cmd /q /c for /f "tokens=* skip=6" %a in ('net localgroup administratoren ^| find /V "Der Befehl wurde erfolgreich ausgeführt."') do echo %a)
This would be the output in the custom inventory rule field
1) #Local_Admins_DE:
Administrator
BTM2000\Domänen-Admins
BTM2000\Exchange Trusted Subsystem
BTM2000\Organization Management
[Zeichenfolge] - n1md4 5 years ago-
Is there a way to filter the output to exclude certain accounts? - PSjacob 5 years ago