Match Lync SIP address with AD user name

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Paul Frankovich Paul Frankovich 7 months ago.

  • Author
    Posts
  • #38939
    Profile photo of Roger
    Roger
    Participant

    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
    Profile photo of Don Jones
    Don Jones
    Keymaster

    Could you not...

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

    ?

  • #38941
    Profile photo of Paul Frankovich
    Paul Frankovich
    Participant

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

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

    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
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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
    Profile photo of Paul Frankovich
    Paul Frankovich
    Participant

    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.

You must be logged in to reply to this topic.