How to scan Domian machines for missing ad groups within local admin group.

I am looking for a way to scan machines on my network for missing Domain group in the local administrators group. I understand that can be corrected via group policy which will enforce to all machines added to domain. However, currently I just need an audit tool or script that will tell me which machines are missing that ad group. Thanks in advance.
Claudia CarlottiIT DirectorAsked:
Who is Participating?
PberSolutions ArchitectCommented:
There is no default tool to do it.  
Here's is a powershell script that will do it based on a input file
just create (or edit) a group policy object that applies to the desired computers OU...under Computer Config, Windows Settings, Security Settings you will see Restricted Groups. Here you can define the membership of the local administrator group...this will not only add the missing members, but remove any incorrect members...
If you're ok with psexec...

Run psexec against entire domain:
psexec \\* -s net localgroup administrators | find /i "domain">results.txt

If you want to run psexec against select stations...
- Open a CMD window
Make a file of station names:
net view >stns1.txt
for /f "tokens=1-2 delims=\ " %a in (stns1.txt) do echo %a>stns.txt

Open in new window

- If needed, manually remove any stations from the list.

Run psexec against stations:
for /f %a in (stns.txt) do (
   echo %a>>results.txt
   psexec \\%a -s net localgroup administrators | find /i "\domain">>results.txt

Open in new window

Claudia CarlottiIT DirectorAuthor Commented:
thanks all
Thanks for the update, Vachik. Glad to help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.