Enabling Lync RCC accounts using powershell

The ability to control a Cisco deskphone using Lync is achieved by enabling remote call control.  This allows a Lync client to communicate with Cisco Unified Presences Servers.  Enabling accounts is a laborious task when performed manually and you must ensure correct syntax and no typo errors.  Powershell can be used to simplify this task.

The following powershell script enables a single lync user for remote call control.  The script performs the following tasks

  1. Return attributes of user to be enabled
  2. Extract user account phone number.  Should already be stored in E.164 format
  3. Create Line URI and Line Server URI variables utilising regex.  This ensures any spaces between numbers are removed
  4. Enable user account for remote call control and populate all relevant attributes.

function enableUser($userLogin)
 $user = get-csAduser $userLogin
 $SIP = $user.sipAddress$phone=$user.phone

 write-host $user.phone
 write-host $phone
 write-host $SIP

 #Create LineURI and LineServerURI
 $lineServerURI = "sip:"+$user.ipPhone+"@nomoredeskphone.com"
 $phoneNoSpaces = ($phone -replace "[^0-9,+]","").trim()
 $lineURI = "tel:"+$phoneNoSpaces+";ext="+$user.ipPhone

 write-host "User : "$user.displayName
 write-host "Line URI : "$lineURI
 write-host "Server URI : "$lineServerURI

 $fullString = "-identity "+$SIP+" -EnterpriseVoiceEnabled $false -LineServerUri "+$lineServerURI+" -LineURI "+$lineURI+" -RemoteCallControlTelephonyEnabled $true"
 write-host $fullString
 write-host "----"
 set-csUser $SIP -EnterpriseVoiceEnabled $False -LineServerUri $lineServerURI -LineURI $lineURI -RemoteCallControlTelephonyEnabled $true

 $group = $args
 if ($args.length -eq 0) {write-host "Syntax : rccEnable.ps1 ";break}
 write-host $args[0]
 enableUser $args[0]

Leave a Reply

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