Who owns an email alias in Office365?
07/03/18 09:39 Filed in: Office365
How do you find if an email address is assigned to a user in Office365?
====
A quick an easy way today - how do you find out if an email address/alias is assigned to a user in your Office365 tenancy?
It's pretty easy really - although not that obvious.
For both of these methods, you'll need to connect to Office365 with PowerShell. To do that, you need to do the following:
$cred=get-credentials
At this point, you'll be prompted to enter your Office365 Admin Credentials
Then, you connect to the session using those credentials (below may be wrapped - the $session and Import-PSSession are two lines).
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
You could then if you wanted export all of your mailbox identities with their email addresses. You can do that with:
get-mailbox -identity *|select-object Identity, EmailAddresses|export-csv csvout.txt
This would put all of your mailboxes and associated Email-Addresses into a CSV.
More specifically, you could just search for the email address you're interested in - you can do that with this command:
Get-Mailbox -Identity * | Where-Object {$_.EmailAddresses -like 'smtp:emailaddress@domain.com'} | Format-List Identity, EmailAddresses
Obviously change the 'emailaddress@domain.com' to whatever you're looking for. You can use wildcards too, so for example DA*@contoso.com would find any alias beginning with DA and @contoso.com
Output is similar to this:
In the words of Heath Ledger…Da Daaaaaa.
blog comments powered by Disqus