Q. Which domain groups have no members?

Jerold Schulman

September 12, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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 offsetlocal ENABLEDELAYEDEXPANSIONfor /f "Tokens=*" %%a in ('dsquery group') do ( call :quiet %%a >nul 2>&1 if "!mbr!" EQU "N" @echo %%a)endlocalgoto :EOF:quietset mbr=Nfor /f "Tokens=*" %%m in ('dsget group %1 -members') do ( set mbr=Y)


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like