JSI Tip 8240. What Active Directory groups exist that are not enumerated by the 'net group /domain' command?

Jerold Schulman

July 11, 2004

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

I have scripted NUMGroups.bat to return a list of Active Directory groups that are NOT enumerated by the net group /domain command.

The syntax for using is NUMGroups.bat is:

NUMGroups

The output is displayed on the console, but you could pipe it to a file using:

NUMGroups>FileName

NOTE: NUMGroups.bat uses Groups.bat and the Active Directory Command-Line Tools.

NUMGroups.bat contains:

@echo offsetlocalif exist "%TEMP%domaingroups.tmp" del /q "%TEMP%domaingroups.tmp"for /f "Tokens=1*" %%f in ('groups D') do ( @echo %%g>>"%TEMP%domaingroups.tmp")for /f "Tokens=*" %%g in ('dsquery group -o rdn') do ( call :look %%g)del /q "%TEMP%domaingroups.tmp"endlocalgoto :EOF:lookset grp=%1set grp=%grp:"=%for /f "Tokens=*" %%f in ('@echo %grp%^|findstr /i /V /L /G:"%TEMP%domaingroups.tmp"') do ( @echo "%%f")



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