Automate Sip Address and UPN name changes in Lync / Skype for Business

When a person’s name changes a lot of organizations implement different strategies of keeping relative addresses in sync. For Lync / Skype for Business and Exchange purposes the four attributes that are important are mail, proxyAddresses, msRTCSIP-PrimaryUserAddress and userPrincipalName. For the best Lync / Skype for Business login experience it is important to keep the sign in address, e-mail address and user principal name the same.

Presuming you are utilizing an Exchange e-mail address policy that changes the e-mail address for users according to their new name, I will show you how to automate the change of the msRTCSIP-PrimaryUserAddress and userPrincipalName attributes. You can automate this by having the script run as a scheduled task. If your organization does not utilize a matching user principal name you you can ignore step #4.

Pre-Step: Before proceeding you may need to import the Lync / Skype for Business and Active Directory commandlets on older versions of PowerShell.

Import-Module ActiveDirectory
Import-Module Lync

Step #1: The first step is to get all Lync / Skype for Business users in the environment. By utilizing the Get-CsUser command only the enabled Lync / Skype for Business users will be returned. (I added a filter to only include email addresses of @yourdomain.com, this can be changed to {WindowsEmailAddress -gt 0} if you want to capture any domain)

$users = Get-CsUser -filter {WindowsEmailAddress -like "*@yourdomain.com"}

Step #2: Now that we have all the Lync / Skype for Business users in our $users variable we can check each of them to identify which sip addresses do not match e-mail addresses.

$users = Get-CsUser -filter {WindowsEmailAddress -like "*@yourdomain.com"}

foreach ($user in $users) { $sipaddress = "sip:" + $user.WindowsEmailAddress
	if ($sipaddress -ne $user.SipAddress)
	{
		Write-Host $user.DisplayName : $user.WindowsEmailAddress mismatch
	}
}

Step #3: Now we can proceed with changing the Sip Address of each user to match their e-mail address.

$users = Get-CsUser -filter {WindowsEmailAddress -like "*@yourdomain.com"}

foreach ($user in $users) { $sipaddress = "sip:" + $user.WindowsEmailAddress
	if ($sipaddress -ne $user.SipAddress)
	{
		Write-Host $user.DisplayName : $user.WindowsEmailAddress Sip Address mismatch
		Set-CsUser $user.SipAddress -SipAddress $sipaddress
	}
}

Step #4: The next step is to handle the User Principal Name change. To do this we utilize the Set-AdUser command from the Active Directory module.

$users = Get-CsUser -filter {WindowsEmailAddress -like "*@yourdomain.com"}

foreach ($user in $users) { $sipaddress = "sip:" + $user.WindowsEmailAddress
	if ($sipaddress -ne $user.SipAddress)
	{
		Write-Host $user.DisplayName : $user.WindowsEmailAddress Sip Address mismatch
		Set-CsUser $user.SipAddress -SipAddress $sipaddress
	}
	if ($user.WindowsEmailAddress -ne $user.UserPrincipalName)
	{
		Write-Host $user.DisplayName : $user.WindowsEmailAddress UPN mismatch
		Set-AdUser $user.SamAccountName -UserPrincipalName $user.WindowsEmailAddress
	}
}

Step #5: If your users are utilizing Lync / Skype for Business meetings, you will also require the meeting link for the calendar invites that were sent out to be updated. Microsoft has released a tool to cover this change. It is a client side tool that the user whose name changed must run from their desktop. In a future article I will cover how to automate this change by using PowerShell and Exchange Web Services.

Download x86 Lync / Skype for Business Meeting Update Tool
Download x64 Lync / Skype for Business Meeting Update Tool

That covers all the steps required to automate the change of the Sip Address and UPN. Feel free to leave any comments or questions and I will be sure to answer them.

62 Responses

  1. Hi Steve,

    *Really* looking forward to your PowerShell/Exchange Web Services tool for updating meeting links after a SIP address change!

    -Amanda

    • Steve Parankewich says:

      Most definitely, how are you currently handling the calendar meeting links after a SIP change?

      • Telling the users before the address change that a change will force them to redo all their SfB meetings, so do they *really* want to change their SIP addresses? 🙂

        I didn’t know about the client-side tool before your article.

    • Wojciech Sciesinski says:

      Me too!

    • Rob Swenson says:

      +1

      Hi Steve (and Amanda),

      Sorry to resurrect this, but we too are *really* looking for a PowerShell/EWS tool like this – we’re planning a SIP change and this would be very helpful to users!!

      Anyone have any luck?

      -Rob

      • Steve Parankewich says:

        I have a closed source solution I can share with you but am unable to make it public.

        • Rob Swenson says:

          That would be great! Thank you! Looking for a way to PM you my contact info and haven’t found it. Can you point me to best method, or does my email address (required to post this message) suffice?

          Thanks again!
          Rob

  2. And now the Meeting Update Tool is gone! Oh no!

    • Steve Parankewich says:

      I located the updated links and updated my article as they rebranded the tool as Skype For Business.

      • …. and it failed for SIP address change (uname@domain.com -> user.name@domain.com). This is approximately 24 hours after uname@domain.com got changed to user.name@domain.com:

        2015-11-04 16:14:32,739 [6] INFO [MeetingLibrary.LyncUtility] Get ConferenceScheduler for sip: uname@domain.com

        2015-11-04 16:14:32,785 [6] ERROR [MeetingLibrary.LyncUtility] SchedulePrivateMeeting, Failed to get inband information. Sip: uname@domain.com Exception details:System.NullReferenceException: Object reference not set to an instance of an object.
        at MeetingLibrary.LyncUtility.GetConferenceScheduler(String sip)
        at MeetingLibrary.LyncUtility.SchedulePrivateMeeting(MeetingDetails meetingDetails)

        2015-11-04 16:14:32,785 [6] ERROR [MeetingLibrary.LyncUtility] SchedulePrivateMeeting, Failed to get ConferenceCapabilities information. Sip: uname@domain.com Exception details:System.NullReferenceException: Object reference not set to an instance of an object.
        at MeetingLibrary.LyncUtility.GetConferenceScheduler(String sip)
        at MeetingLibrary.LyncUtility.SchedulePrivateMeeting(MeetingDetails meetingDetails)

        2015-11-04 16:14:32,785 [6] ERROR [MeetingLibrary.LyncUtility] SchedulePrivateMeeting, Failed to get conferenceScheduler. Sip: uname@domain.com Exception details:System.NullReferenceException: Object reference not set to an instance of an object.
        at MeetingLibrary.LyncUtility.GetConferenceScheduler(String sip)
        at MeetingLibrary.LyncUtility.SchedulePrivateMeeting(MeetingDetails meetingDetails)

        It ran “successfully” (though unnecessarily) for meetings scheduled as user.name@domain.com.

        (hope I’m not distracting you from the PowerShell/EWS method, which just has to be way better than this – I’m willing to deal with a very unrefined tool at this point.)

        • Steve Parankewich says:

          We were having issues with the tool as well until we completely patched Windows 7 with every possible Windows Update patch. Give that a go first. Yes I keep knocking on Microsoft’s door for the query I need to get the new link information from SQL but have not received it yet.

          • Ooooohh! I’m close to working that query out – I was completely stumped by the Outlook/Exchange part.

          • And by “close,” I mean that I’ve gotten to the point where if you give me their new SIP address, I’ll give you all the meeting codes, which combined with their SIP domain’s Simple URL for meeting joins, will give the right link for each meeting, as well as the meeting titles and other information (do PSTN joiners have to wait in a lobby, etc).

            What info did you need?

          • Steve Parankewich says:

            Lets take a closer look offline, I sent you an e-mail with my contact details.

        • Bart Vanlessen says:

          Having the same issue , any idea what is causing this ?

  3. Caveat: I’m getting that info in a rather unsupported way, and there’s nothing external preventing MSFT from changing that the next time they do a database update for Lync/SfB.

  4. Jonas Didriksson says:

    Hi Steve
    As I’m planing for a SIP address change on 500+ user, I’d also like to have some information via PM, same as Rob Swenson got. Is that possible?

    Regards Jonas Didriksson

  5. Geert says:

    I have a SIP domain change for 6000+ user to do. Interested in your automation procedure by using PowerShell and Exchange Web Services. You can email me.

    • Steve Parankewich says:

      I am working on an open source method of handling this and will let you know when I am done.

      • Geert says:

        In the meantime we solved the problem by doing a URL redirect in the internal and external IIS websites of SfB (IIS “URL Rewrite” option). If a request for the old URL comes in we redirected it to the new URL (in our case the old SIP extension is no longer in use after the migration). It works fine this way.

      • Morten says:

        Hi Steve
        Do you have any info on the open source method?
        We found out that Microsoft tool isn’t working for every user, so we’re holding back on changing the SIP address. We’re 5000+ users

        • Steve Parankewich says:

          We moved to Skype Online which does not allow you to grab the new/old method so I abandoned that open source method. What have you found with Microsoft’s tool not working 100%?

  6. Drew Turner says:

    Hey Steve,

    We’re moving our users to SfB Online, and the meeting update tool actually doesn’t work correctly in this instance. Specifically for meetings that the migration tool is run against, the meeting join URL and dial-in conference ID do not seem to sync up properly. New meetings work fine, its just migrated meetings.

    I have a feeling your closed source tool might get us closer to figuring out a resolution to this issue. Do you mind sharing with me via email? Thanks man!

    P.S. – I have a pretty detailed write-up of the full migration tool issue and the steps we’ve attempted to resolve if your’e interested.

    • Steve Parankewich says:

      Did you reach out to Microsoft on the tool issue? The tool will need to be run after the user’s SIP has changed.

  7. Udo Seiler says:

    Hello Steve,
    would it be possible to get a version of your centralized Tool?
    I would really appreciate to test it.

    Best regards,

    Udo

  8. Vishnu Dutt says:

    Hello Steve,

    we are planning to move the our 5000 Lync 2010 users to SFB online. We don’t want users to run the meeting migration tool. Could you help me to automate this.

    • Steve Parankewich says:

      Sure, contact me and I will be able to help you out. If you simply upgrading to Skype you will not require meeting changes. The only time you would need that is for a domain change or mass e-mail address/sign-in address changes.

  9. Vishnu Dutt says:

    Thanks for your reply Steve. We are moving the users from On premises to Microsoft cloud. Since the number of users is more than 5000, we don’t want to run the meeting update utility from client machines. searching for some solution to get this done from server side. I hope this is workable. Please share your contact details so that I should contact you.

  10. Vishnu Dutt says:

    Waiting for your response Steve….

  11. Priyanka says:

    Hi Everyone,

    We are planning a change for SIP Address for more than lakh users , can anyone help me with the custom solution which we are talking about here.

  12. stephane dieny says:

    Just wondering, you don’t change msRTCSIP-PrimaryUserAddress ? One of the previous command is changing that attribute too ?
    ty
    /s

  13. Karen says:

    We are looking for a automation process on Skype Business Migration Tool. I can push the install out through SCCM 2012 but the application that takes you through the process we need to “automate” those steps. Can you assist with that???

    Step #5: If your users are utilizing Lync / Skype for Business meetings, you will also require the meeting link for the calendar invites that were sent out to be updated. Microsoft has released a tool to cover this change. It is a client side tool that the user whose name changed must run from their desktop. In a future article I will cover how to automate this change by using PowerShell and Exchange Web Services.

  14. Morten Holst says:

    Hello.

    We are gonna migrate 2000 users to Skype for Business and at the same time change the UPN to email adress in Skype.
    I wonder if you could be kind enough to share your Powershell script for changing meeting URLs after migration?

    Morten Holst

  15. Alistair Wilson says:

    Hello

    I am looking at changing some UPNs and SIP Addresses – the part about changing meeting URLS would be awesome to get -so if I can get a copy of the powershell that would be appreciated.

    However, is anyone out there aware of a process to allow the client’s sign in address to be changed when they log in after the changeover?

    That would be something very useful!

    Thanks

    Alistair Wilson

  16. Markus Gruber says:

    Dear Mr. Parenkewich,

    As many other, I am highly interested in your script solution to update Skype for Business meeting invites with the most recent information via Exchange Web Services.

    I would be glad hearing from you regarding this topic.

    Regards,

    Markus Gruber

  17. Henk Tittel says:

    Dear Steve,

    We have some users who SIP record changes due to switches internally companies, marriage, divorce and so.
    Most off these user have numerous meetings in their outlook, now I saw you had an solution which you could not share in public, could you be so kind to sent me an mail?

    Kind regards,

    Henk

  18. Rajesh says:

    Hello Steve,

    we are planning to move the our 500+ SFB users from one service provider to another. We don’t want users to run the Meeting Update Tool for Skype for Business and Lync. Could you help me to automate this through powershell from Server side. Thanks a loot……

  19. Ivo Hanbeukers says:

    Hi Steve

    Can I get a copy of your script. We want to change the upn, sip and pri mail address of the users.

    br. Ivo

  20. Thomas says:

    Hello,

    We are planning a email & SIP domain change for around 6000 people and we are looking for a way to reduce user impact.
    I’ve read your post about changing the SIP domain and the promise of a tool to update Skype Meeting from the server-side catched me!
    Can you provide me with information on your ‘closed source solution’ and your open source solution ?

    Best regards

    • Steve Parankewich says:

      Are you still looking for this? With the high demand I will post what I have for others to use.

      • Henk Tittel says:

        Dear Steve,

        Yes we are still looking for an solution when users change their mail addresses, currently this means that the users or their secretaries manually have to redo all existing skype for business meetings.

        Kind regards,

        Henk

      • Andy Wilson says:

        Hi Steve

        This would be really useful if you still have it – could save us an awful lot of work!

        I did search for your updated post but wasn’t able to find it.

        Thanks
        Andy

  21. Nat Winters says:

    Did the powershell solution ever get posted?
    I would also be eagerly interested to see the code and make use of it as we are ungoing a merger, and rebranding so we have to update/change SIP addresses for 8000 users, and a central update is preferable to asking users to run a local tool…

    • Steve Parankewich says:

      The PowerShell solution was abandoned. With everyone moving to Skype Online which automatically sends out the updated meetings and on prem being phased out the needs are pretty low. With Teams taking over for Skype there just hasn’t been a large need.

  1. October 12, 2015

    […] for Business meeting update tool that is required when a Sip Address is changed. Head on over to PowerShellBlogger.com for the full […]

  2. November 23, 2016

Leave a Reply

Your email address will not be published. Required fields are marked *