• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 609
  • Last Modified:

Find all the users in a OU if the "Hide from Exchange address list" is ticked

Hi,

Find all the users in a OU if the "Hide from Exchange address list" is ticked.

Is there a script that can do this.

Regards
Sharath
0
bsharath
Asked:
bsharath
  • 6
  • 5
1 Solution
 
Farhan KaziSystems EngineerCommented:
Try this:

Click Start -> Run -> Cmd.exe

DSQuery * "OU Name Here" -Filter "(&(sAMAccountType=805306368)(MSExchHideFromAddressLists=*))" -Attr samAccountName

Example:

DSQuery * "OU=ACCOUNTS,DC=TRAINING,DC=COM" -Filter "(&(sAMAccountType=805306368)(MSExchHideFromAddressLists=*))" -Attr samAccountName

0
 
bsharathAuthor Commented:
Hi Farhan...
I ran this script and it got me some names but when i see in ADS they are not checked and they are visible in outlook.
Eevn my name is displayed but i am visible in outlook Gal....
Any help/...
0
 
Farhan KaziSystems EngineerCommented:
Apply following command and post output.

Click Start -> Run -> Cmd.exe

DSQuery * -Filter "(sAMAccountName=BSharath)" -Attr samAccountName MSExchHideFromAddressLists
                                                                    ^ Enter username who have MSExchHideFromAddressLists checked and unchecked.



0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
bsharathAuthor Commented:
I get this...
C:\>DSQuery * -Filter "(sAMAccountName=Sharathr)" -Attr samAccountName MSExchHid
eFromAddressLists
  samAccountName    MSExchHideFromAddressLists
  SharathR          FALSE

C:\>DSQuery * -Filter "(sAMAccountName=seenua)" -Attr samAccountName MSExchHideF
romAddressLists
  samAccountName    MSExchHideFromAddressLists
  seenua
0
 
Farhan KaziSystems EngineerCommented:
Click Start -> Run -> Cmd.exe

DSQuery * "OU Name Here" -Filter "(&(sAMAccountType=805306368)(!MSExchHideFromAddressLists=FALSE))" -Attr samAccountName

Example:

DSQuery * "OU=ACCOUNTS,DC=TRAINING,DC=COM" -Filter "(&(sAMAccountType=805306368)(!MSExchHideFromAddressLists=FALSE))" -Attr samAccountName
0
 
bsharathAuthor Commented:
Farhan i get 100's ...Of usernames...But they are not ticked...
0
 
Farhan KaziSystems EngineerCommented:
What about this....

DSQuery * "Optional OU Name Here" -Filter "(&(sAMAccountType=805306368)(MSExchHideFromAddressLists=TRUE))" -Attr samAccountName -Limit 0
0
 
bsharathAuthor Commented:
Ok Farhan Got it ...This works...
Any way to scan the whole Domain the same way...
0
 
Farhan KaziSystems EngineerCommented:
* To start search from Domain Root

DSQuery * DomainRoot -Filter "(&(sAMAccountType=805306368)(MSExchHideFromAddressLists=TRUE))" -Attr samAccountName -Limit 0


* To start search from Forest Root

DSQuery * ForestRoot -Filter "(&(sAMAccountType=805306368)(MSExchHideFromAddressLists=TRUE))" -Attr samAccountName -Limit 0
0
 
bsharathAuthor Commented:
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.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now