Every now and then I run into one account that has something weird about it. Usually it would display an old phone number even when you changed the phone number in AD, ran Update-CsAddressBook and deleted all old records you had.
However, when looking at the user’s contact card you’ll still see the old number AND the new number, resulting in users dialling the wrong number, resulting in call failures, resulting in service desk calls, do I need to go further…?
I read various workaround involving running various scripts against the RTC database, and to be honest – there are some thing I’d rather not touch.
Workaround for the “corrupted” users would normally be disabling them and then re-enabling the for Skype for Business \ Lync.
This will do the trick, BUT has a huge downside: if you didn’t export the users’ data they’ll lose all of their groups, favourites, contacts, etc. Also, you’ll have to re-apply the user’s policies, line URI, private numbers, etc.
This is both time consuming and would require to schedule a maintenance window as the user is going to be kicked out.
So, came up with the following script:
- You’ll provide the user’s sip address.
- The system will confirm the user’s name so you’re happy to move on.
- The user’s data will be exported to a folder on your local C drive (Path is always C:\y0av\users\<username>)
- The user’s Get-CsUser data will be exported to a text file in the same folder so you can compare the settings once you’re done.
- The user will be disabled, and the script will run Update-CsUserDatabase and pause for 15 seconds.
- The user will then be enabled and the script will pause for another 15 seconds. The purpose of the pauses is to allow for the changes to set in. I tested various environments and 30 seconds seems like enough time. I’ll add the option to change the pause in future versions.
- The user’s polices will be re-applied.
- The system will run Update-CsUserDatabase and Update-CsAddressBook to reflect the changes.
- The user’s data dump is saved in the C:\y0av\users folder, and you can manually delete it if you feel you no longer need it.
- If the user is configured with a Private Line you’ll have to use the script with the -PrivateLine switch.
- PIN must be reset for the user after the account is recreated.
- Conference ID will change – any recurring Skype for Business \ Lync meetings must be re-sent.
What’s the bonus?
All the tests I made show that the script runs fast enough to not interfere with the user’s activity; I ran this against a user during a call, the script completed and the call never disconnected.
Try this on a test account before killing someone’s call in your organization…🙂
Policies this script will save and re-apply:
Hosted Voicemail (True or False)
External Access Policy
Hosted Voicemail Policy
Persistent Chat Policy
Third Party Video System Policy
User Services Policy
Voice Routing Policy
To run the script for a user with a private line, run:
Download the script here.