Hello All!
Hoping you can help me out, I am trying to pull the Telephone Number and IPPhone properties from AD objects and update the LineURI string on there Lync user. For some reason I can not get the stupid semicolon ; to properly display like below. I am a novice to scripting i haven’t done it probably in about 5 years and i’m rusty on certain syntax, I did research and found some escaping characters for Powershell \ and ’ but I can’t seem to get it to work.
This is what i’m trying to accomplish:
tel:3035641111;ext=1111
By using this script:
$enabledUsers = Get-CsAdUser testuser
foreach ($user in $enabledUsers)
{
$phoneNumber = $user.Phone
$phoneNumber = $phoneNumber -replace "[^0-9]"
$extNumber = $user.IPPhone
$phonenumber = "TEL:+" + $phoneNumber + ";ext:" + $extNumber
Set-CsUser -Identity $user.Identity -LineUri $phoneNumber
}
This is the typical error I receive from Powershell:
PS C:\temp\junk> .\test_LINEURI.ps1
Set-CsUser : Extension token missing after telephone number. Specify the missing extension token and then try again.
At C:\temp\junk\test_LINEURI.ps1:10 char:9
-
Set-CsUser -Identity $user.Identity -LineUri $phoneNumber
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (
[Set-CsUser], FormatException
- FullyQualifiedErrorId : System.FormatException,Microsoft.Rtc.Management.AD.Cmdlets.SetOcsUserCmdlet
Any help would be appreciated, as i’m beating my head and can’t find a way to get around this. THanks!
- CategoryInfo : NotSpecified: (