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

set AD msExchHideFromAddressLists attribute for many users

4,839 views
Skip to first unread message

Cathy

unread,
Dec 22, 2012, 11:20:26 AM12/22/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

Bear

unread,
Jan 8, 2013, 12:56:46 PM1/8/13
to
You can use the example below...


$users = get-content path\filename.txt

foreach ($user in $users)
{
set-mailbox "$user" -HiddenFromAddressListsEnabled $true
}

or use Quest PowerShell cmdlets, they were free and think they still are
example...

get-qaduser -disabled |set-mailbox -HiddenFromAddressListsEnabled $true
0 new messages