Match Lync SIP address with AD user name

Welcome Forums General PowerShell Q&A Match Lync SIP address with AD user name

This topic contains 5 replies, has 3 voices, and was last updated by

 
Participant
2 years, 7 months ago.

  • Author
    Posts
  • #38939

    Participant
    Points: 0
    Rank: Member

    Hi,
    We have a CSV list of Lync SIP logins (ex. user.name@corp.com), but need to match this list with their Active Directory usernames and/or employeeID. GET-CSuser will not return the necessary AD variable. Anyone have any ideas? Thanks.

    Roger

  • #38940

    Keymaster
    Points: 1,673
    Helping HandTeam Member
    Rank: Community Hero

    Could you not...

    $sip = "user.name@corp.com"
    $username = $sip -replace "@corp.com",""
    Get-ADUser -Identity $username

    ?

  • #38941

    Participant
    Points: 0
    Rank: Member

    Maybe use the AD Module if SIP is the same as mail address?

    Import-Csv .\LyncSip.csv | %{Get-ADUser -Filter "Mail -eq '$($_.sip)'"}
  • #38942

    Participant
    Points: 0
    Rank: Member

    Sorry for the confusion...What we need from the list of sip addresses is to query AD for the actual AD usernames (specifically employeeid attribute) of the user. Some of the users do not have an email address (most do) that would match their sip address.

  • #38943

    Keymaster
    Points: 1,673
    Helping HandTeam Member
    Rank: Community Hero

    So, what's in the CSV? You said the SIP address was "user.name" – is that not the username?

    In other words, what's in the CSV, specifically, that you can match to something in AD?

  • #38944

    Participant
    Points: 0
    Rank: Member

    Here is a sample I came up just to show the theory. Not exactly what you need but it could be a good start.

    Import-Csv .\UserSips.csv |
    %{Get-ADUser -Filter "msRTCSIP-PrimaryUserAddress -eq 'sip:$($_.sip)'" -Properties employeeID |
    select employeeID}

    Output
    employeeID
    ----------
    ######

    Is that what you were looking for?

    Edit: I must be a slow typist. Don is always 2 minutes ahead of me by the time I hit submit.

The topic ‘Match Lync SIP address with AD user name’ is closed to new replies.