[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

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
0
bsharath
Asked:
bsharath
  • 9
  • 8
1 Solution
 
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
 
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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
 
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
 
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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now