fortypoundhead.com

Which domain groups have no members?

Primary Category = Tip

Posted On 2006-09-25 by FortyPoundHead
Keywords: Active Directory groups
Tags: Tip Windows 2000 Windows Server 2003
Views: 1507
Rating: / 5.00

  • 1
  • 2
  • 3
  • 4
  • 5

 

Using the Active Directory command-line tools, I have scripted NoMembers.bat to display the distinguished name of all domain groups that have no members.

The syntax for using NoMembers.bat is:

NoMembers

NoMembers.bat contains:

@echo off
setlocal ENABLEDELAYEDEXPANSION
for /f "Tokens=*" %%a in ('dsquery group') do (
call :quiet %%a >nul 2>&1
if "!mbr!" EQU "N" @echo %%a
)
endlocal
goto :EOF
:quiet
set mbr=N
for /f "Tokens=*" %%m in ('dsget group %1 -members') do (
set mbr=Y
)

About the Author

FortyPoundHead has posted a total of 1975 articles.

You can find more information from FortyPoundHead by visiting .

Comments On This Post

No comments on this post yet!

 

Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:54.163.159.27

Before you can post, you need to prove you are human. If you log in, this test goes away.