Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

set AD msExchHideFromAddressLists attribute for many users

304 views
Skip to first unread message

Cathy

unread,
Dec 21, 2012, 8:07:51 PM12/21/12
to
I need to set msExchHideFromAddressLists to true for all disabled accounts

I found the following website that I would like to use
http://msmvps.com/blogs/it-is-etc/archive/2010/12/16/how-to-change-attribute-in-ad-alternatives.aspx

Therefore my script will look something like this

Load-Module ActiveDirectory
$user = Get-ADuser user.name
$user.msExchHideFromAddressLists = "TRUE"
Set-ADUser -instance $user

I have set up an AD Query for all disabled users and can easily export all
usernames to a text file

What I need to know is how to set up a loop that could check the csv file
and loop through each usernames in it and repeat this until all the users in
the file are set

Any help will be greatly appreciated

Regards
C

kunal udapi

unread,
Nov 4, 2016, 5:36:29 AM11/4/16
to
Check this out, create a textfile.txt on the c: drive, add all the users.

Load-Module ActiveDirectory
$u = cat c:\textfile.txt
foreach ($u in $user) {
$user = Get-ADuser user.name
$user.msExchHideFromAddressLists = "TRUE"
Set-ADUser -instance $user
}

http://vcloud-lab.com
0 new messages