Adding Ext attribute to bulk users with PowerShell

Ever had the need to bulk modify users Tel URI and add the “;ext=” attribute with the extension. Well here is a PowerSHell command to do just that.

get-csuser | ? {$_.lineuri} | ? {$_.lineuri -notlike "*;ext=*" } | % {$newlineuri = $_.lineuri + ';ext=' + $_.lineuri.substring($_.lineuri.length - 4); set-csuser $_.identity -lineuri $newlineuri}

That’s one line in PowerShell. It will get all the users in Lync that have a line URI set but where that line URI does not already have the “;ext=” syntax in it. Then, it will take the last four digits of the user’s line URI and use that to set a new line URI that has “;ext=XXXX” appended. (If you want to change the length of the extension, change the 4 to something else.)

Be careful with this command. It “should” be pretty safe. We can’t completely promise that suddenly adding “;ext=XXXX” to everyone’s line URI won’t cause an unexpected issue. Make sure to test in a lab first.

Thanks to Doug Lawty for the command and explanation of its use.



  1. We have enabled all of our EV users with the EXT defined so for the items which require an extension to be input for the users are easier with only 4 digits.

    Any downsides to doing this?

    1. No real downside. It is the recommended and supported method to configure the tel uri and as you point out it can make a users life a lot easier.

      Potential interop issue do occur from time to time though so its something to be aware of.


Note: Only a member of this blog may post a comment.