Search Tools Links Login

Which domain groups have no members?

Posted: 2006-09-25
By: FortyPoundHead
Viewed: 1,788

Filed Under:

Tip, Windows Server

No attachments for this post

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.bat contains:

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

Comments on this post

No comments have been added for this post.

You must be logged in to make a comment.