Deleted accounts in AD still exist in DL

D

.d0t

Hi there,

i have a Distribution List with users as members. Some user accounts have
been deleted, but when an e-mail is sent to the DL, we receive NDR's for the
deleted accounts. the deleted accounts do not appear in the membership
list.

Any suggestions on how to remove these from the DL?

thanks in advance
 
J

Jerold Schulman

Hi there,

i have a Distribution List with users as members. Some user accounts have
been deleted, but when an e-mail is sent to the DL, we receive NDR's for the
deleted accounts. the deleted accounts do not appear in the membership
list.

Any suggestions on how to remove these from the DL?

thanks in advance
Do the delete accounts show up using the Active Directory command-line tools,
tip 6820 in the 'Tips & Tricks' at http://www.jsiinc.com?

@echo off
for /f "Tokens=*" %%g in ('dsquery group domainroot -name *') do (
for /f "Tokens=*" %%d in ('dsget group %%g -secgrp') do (
if /i "%%d" EQU "no " for /f "Tokens=*" %%m in ('dsget group %%g
-members') do (
for /f "Tokens=*" %%u in ('dsget user %%m -dn') do (
set dist=%%g&set user=%%m&set stat=%%u&call :find
)
)
)
)
goto :EOF
:find
if /i "%stat:~0,12%" EQU "dsget failed" @echo %dist% %user%

Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top