The Multifunctioning DBA

Aug 30 2010   10:00AM GMT

Exchange Email Changes (Users meet Mialboxes)

Colin Smith Colin Smith Profile: Colin Smith

Now that I have both the users stored in an array and the mailboxes stored in another array it is time to start making sure that I am working with a mailbox and a user account that match up. I do not want to look at my user account and Johns Mailbox and start making changes based on what I find in those two accounts that do not affect the same account. So here is what I did. It is really very simple and I will be adding more to this later for filtering of accounts and decision making. For now though here is the basics of how to make sure that the accounts are matching.

foreach($mailbox in $mailboxes)


$exsam = $mailbox.SamAccountName

foreach ($user in $users)


$adsam = $user.SamAccountName

if ($exsam -eq $adsam)


Echo “We have a match”



So I first get the samaccountname from Exchange and then I do the same for AD. Once I find that the Sam Names are the same I know that I have a match. That simple.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: