04/30/2019 273 views

Is there a way for us to see who is part of the local administrators group on devices?

0 Comments   [ + ] Show comments


All Answers


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')

Answered 04/30/2019 by: PaulGibson
Senior Yellow Belt

  • 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:
    BTM2000\Exchange Trusted Subsystem
    BTM2000\Organization Management