Home > Lync Server/Skype for Business Server > One Liner – Find Users Whose SMTP Address Doesn’t Match Their SIP Address

One Liner – Find Users Whose SMTP Address Doesn’t Match Their SIP Address

This one liner will list all users who have both SMTP email addresses (which appear in the Windows Email Address filed on their AD account), and a SIP address, but they don’t match. This is helpful in identifying users who may be contractors with their  own email address at their respective company, but have SIP addresses on your system. It’s also helpful in locating users who have typos in one of the two, or who are inadvertently assigned an incorrect SIP domain.

Get-CsAdUser | Where-Object {($_.WindowsEmailAddress -and $_.SipAddress) -and ($_.WindowsEmailAddress -ne ($_.SipAddress -replace "sip:",""))} | Select-Object DisplayName,WindowsEmailAddress,SIPAddress

This yields results such as

DisplayName       WindowsEmailAddress                    SIPAddress                 
-----------       -------------------                    ----------                 
Laurie Lederhouse llederhouse@fourthcoffee.com           sip:llederhouse@contoso.com
Eileen Alfini     eileena@fabrikam.com                   sip:ealfini@contoso.com    
Mike McGrath      mmcgrath@wingtiptoys.com               sip:mmcgrath@contoso.com   
Gavin Parmar      gparmar@contoso.com                    sip:goarmar@contoso.com

In this example, we see that the first three have different SMTP domains than SIP domains. In the last user, we see that the username part of the addresses is different, but the domains are the same. If you want to strip out the “sip:” from the SIPaddress column, we can add a little formatting and come up with

Get-CsAdUser | Where-Object {($_.WindowsEmailAddress -and $_.SipAddress) -and ($_.WindowsEmailAddress -ne ($_.SipAddress -replace "sip:",""))} | Select-Object displayname,windowsemailaddress,@{Expression={$_.sipaddress -replace "sip:"};label="SipAddress"}


  1. January 17th, 2017 at 00:58 | #1

    Nice one.

    Just substitute Get-CsAdUser with Get-CsOnlineUser and it works for Skype for Business Online.

  1. September 8th, 2013 at 04:28 | #1
  2. September 8th, 2013 at 04:35 | #2
  3. January 23rd, 2015 at 07:21 | #3