Skip to content
Menu

Audit Local Administrators Group Members

Local admin rights get handed out in a hurry and rarely taken back. This script lists everyone in the group, flags the ones you didn't expect and finds the orphaned accounts. It changes nothing.

Audit local Administrators group members is free for members.

Enter your email to create your free account and get the file. It also subscribes you to the weekly email, and you can unsubscribe any time.

Already a member? Sign in.

Reviews

Nobody has reviewed this yet.

Leave a Review

LanguagePowerShell
Runs onWindows 10, Windows 11, and Windows Server 2016 or newer
NeedsPowerShell 5.1, run as an administrator to read the group
Read-onlyReads, changes nothing

What It Does

Local administrator rights get handed out in a hurry, for one install, on a Friday, and almost nobody takes them back. This script reads the local Administrators group and writes one object per member: the name, what kind of principal it is, where it came from, its SID, and whether it is one you expected.

It finds the group by its well-known SID rather than by the name Administrators, so it returns the right group on a machine installed in any language. You give it the members you expect with -Expected, and everything else is flagged.

A member whose SID no longer resolves, because the domain account was deleted or the machine moved between domains, makes the built-in Get-LocalGroupMember throw. Those are the members most worth finding, so the script falls back to reading the group through ADSI and reports them instead of failing. It changes nothing: no account is added, removed, renamed or disabled, and no file is written.

Before You Run It

  • Run it as an administrator. As a standard user it returns an access-denied error rather than a short list.
  • Decide what belongs in -Expected before the first run, or every machine reports the same handful of names as unexpected.
  • Remember that a nested group hides its members: a domain group in the local Administrators group appears as one line.
  • This one reads. Anything you decide to remove afterwards is a separate, deliberate change, on a machine you can reach again.

The Script

audit-local-admins.ps1 · 104 lines · 3.5 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.