Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Find if any user has more than 1 SMTP address. thats different from the one it actually needs to be.

Hi,

Find if any user has more than 1 SMTP address. thats different from the one it actually needs to be.
We have just migrated some users from one Exchange to another 2003 to 2007
its in a different forest. i want help with a script that can query every linked mailbox within an OU and all Ou's within it and find all email addresses with the smtp's that are different.
In smtp i will have something like this
Sha@plc.com
Sha@rlc.com
Sha@uic.com
Sha@rty.com
sharath@plc.com
So in the above sharath@plc.com is the different email smtp here

Regards
Sharath
Avatar of Aard Vark
Aard Vark
Flag of Australia image

You can just return any users who have any EmailAddress with the plc.com domain in them, or does it need to be specifically targeted at SMTP addresses (ie, you may have a notes address or something with the plc.com domain)?

Get-Mailbox | ? {$_.EmailAddresses -match "\@plc.com$"}

Open in new window

Avatar of bsharath

ASKER

I need to find any user who may not match the display name
Say for example
My Display name is
Sharath yui
My email is
Sharath.yui@plc.com
As i have many other domains these are default
Sharath.yui@dev.com
Sharath.yui@some.com
if there is any other name other than mine i want the results

That makes it a bit easier.

Chris
Get-QADUser -SearchRoot "OU=somewhere,DC=domain,DC=com" `
    -LdapFilter "(&(proxyAddresses=*)(displayName=*))" -IncludedProperties ProxyAddresses | `
  ?{ $_.ProxyAddresses -NotMatch "^(x500)|(smtp:$($_.DisplayName -Replace ' ', '.')@)" } | `
  Select-Object DN, Name, @{n='ProxyAddresses';e={ "$($_.ProxyAddresses)" }}

Open in new window

Hi Chris
I get this
The term 'Get-QADUser' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
 spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:12

Quest... you have to load the CmdLets... I'm sure we've been here before ;)

Chris
I get the whole list of X400/X500/Smtp but not the exact mismatches. how can i route them to a txt file.

This version will export the entries that failed to match to "SomeFile.csv".


Get-QADUser -SearchRoot "OU=somewhere,DC=domain,DC=com" `
    -LdapFilter "(&(proxyAddresses=*)(displayName=*))" -IncludedProperties ProxyAddresses | `
  Select-Object DN, DisplayName, @{n='ProxyAddresses';e={ 
    $Label = $_.DisplayName -Replace " ", "."
    [String]::Join(" ", $($_.ProxyAddresses | ?{ $_ -NotMatch "^(x500)|(smtp:$Label@)" })) }} | `
  ?{ $_.ProxyAddresses -ne $Null } | `
  Export-CSV "SomeFile.csv"

Open in new window

I get this

WARNING: This search was configured to retrieve only the first 1000 results. To retrieve more results, increase the
size limit using the -SizeLimit parameter or set the default size limit using Set-QADPSSnapinSettings with the
-DefaultSizeLimit parameter. Use 0 as the value of size limit to retrieve all possible search results.

But it gets all users to the file. But not just users who have multiple SMTP's
i want to find SMTP's that are different
ASKER CERTIFIED SOLUTION
Avatar of Chris Dent
Chris Dent
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will have same user with different email id's like
Sharath.yui@plc.com
Sharath.yui@yui.com
Sharath.yui@qwe.com
Sharath.yui@qqu.com

Are these 4 are valide. Anything other than these @ for the user is the ones that i need to find

I built it based on the criteria you defined.

Please give me an example including the "wrong" addresses if the code above isn't working for you.

Chris
Thank you. I have all into an excel will dletee the common and then i get the mismatches. Solves the purpose
:-)