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)

Posted by: PaulGibson 3 years ago
Orange Belt

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

  • 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
    [Zeichenfolge] - n1md4 3 years ago
    • Is there a way to filter the output to exclude certain accounts? - PSjacob 2 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ