Get all the users and groups who are in the Accept Messages only from

Hi,

I have some groups which is configured to Accept Messages only from..Is there a way to get all these groups with the members to a file.

Get all the users and groups who are in the Accept Messages only from

If required i can mention the group names too..All are oon the Root Domain.

Regards
Sharath
LVL 11
bsharathAsked:
Who is Participating?
 
Farhan KaziSystems EngineerCommented:
Check following script.

:: SCRIPT START
@ECHO OFF
SETLOCAL EnableDelayedExpansion
IF EXIST GroupMembers.txt DEL /F /Q GroupMembers.txt
SET DrawLine=-----------------------------------------------------------
SET Qry=DSQuery * ForestRoot -Filter "(&(authOrig=*)(objectCategory=group))" -Attr sAMAccountName -Limit 0 -L
ECHO !DrawLine! >>GroupMembers.txt
FOR /F "delims=*" %%g IN ('%Qry%') DO (
      ECHO Querying: %%g
      ECHO Members Of: %%g >>GroupMembers.txt
      DSQuery * ForestRoot -Filter "(samAccountName=%%g)" -Attr authOrig -L >>GroupMembers.txt
      ECHO !DrawLine! >>GroupMembers.txt)
ECHO.&ECHO Script Complete. Check 'GroupMembers.txt' file.
ENDLOCAL
:: *** SCRIPT END ***
0
 
Farhan KaziSystems EngineerCommented:
Hi Sharath,
Check following script if this works for you!

:: SCRIPT START
@ECHO OFF
SETLOCAL EnableDelayedExpansion
IF EXIST GroupMembers.txt DEL /F /Q GroupMembers.txt
SET DrawLine=-----------------------------------------------------------
SET Qry=DSQuery * -Filter "(&(authOrig=*)(objectCategory=group))" -Attr sAMAccountName -Limit 0 -L
ECHO !DrawLine! >>GroupMembers.txt
FOR /F "delims=*" %%g IN ('%Qry%') DO (
      ECHO Querying: %%g
      ECHO Members Of: %%g >>GroupMembers.txt
      DSQuery * -Filter "(samAccountName=%%g)" -Attr authOrig -L >>GroupMembers.txt
      ECHO !DrawLine! >>GroupMembers.txt)
ECHO.&ECHO Script Complete. Check 'GroupMembers.txt' file.
ENDLOCAL
:: *** SCRIPT END ***
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
bsharathAuthor Commented:
Farhan

Where should i mention the input.
When i save the code and run it i just get a ------ nothing else.
Will it get all the users and groups who are in the Accept Messages only from box?
0
 
bsharathAuthor Commented:
Farhan this works fine from the local Domain but from the root domain it does not fetch.Can you change it to even get details from the root domain
0
 
Farhan KaziSystems EngineerCommented:
Replace following line
SET Qry=DSQuery * -Filter "(&(authOrig=*)(objectCategory=group))" -Attr sAMAccountName -Limit 0 -L
With
SET Qry=DSQuery * ForestRoot -Filter "(&(authOrig=*)(objectCategory=group))" -Attr sAMAccountName -Limit 0 -L
0
 
bsharathAuthor Commented:
Farhan its getting me all the groups but not the members in it.
There are users who have been given access (Only from) They are not being listed.
0
 
Farhan KaziSystems EngineerCommented:
Did you run the script with above changes?
0
 
bsharathAuthor Commented:
Yes Farhan without the change i did not get anything.Now i am getting the names of the groups but not the members...
0
 
Farhan KaziSystems EngineerCommented:
Can please post the contents of 'GroupMembers.txt' file
0
 
bsharathAuthor Commented:
I get this...

-----------------------------------------------------------
Members Of: CHENNAI
-----------------------------------------------------------
Members Of: France
-----------------------------------------------------------
Members Of: Newyork
-----------------------------------------------------------
Members Of: Warrington
-----------------------------------------------------------
0
 
Farhan KaziSystems EngineerCommented:
Apply following commands (one-by-one) and post the results.

Click Start -> Run -> Cmd.exe

DSQuery * -Filter "(samAccountName=CHENNAI)" -Attr authOrig -L
DSQuery * -Filter "(samAccountName=France)" -Attr authOrig -L
DSQuery * -Filter "(Name=Warrington)" -Attr authOrig -L
DSQuery * -Filter "(samAccountName=Newyork)" -Attr * -L
0
 
bsharathAuthor Commented:
farhan

I dont get any results...

0
 
Farhan KaziSystems EngineerCommented:
What about following:

DSQuery * ForestRoot -Filter "(samAccountName=Newyork)" -Attr * -L

DSQuery Group -Name Newyork
0
 
bsharathAuthor Commented:
For this i get all the details...

DSQuery * ForestRoot -Filter "(samAccountName=Newyork)" -Attr * -L

Its a very big data so not pasting it here

DSQuery Group -Name Newyork
I dont get any results
0
 
bsharathAuthor Commented:
Thanks a lot farhan

Any help with the other Q's
0
 
Farhan KaziSystems EngineerCommented:
Thanks for the points.
Can you please post the links here...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.