• Vik Jaswal

PowerShell Module for Sonus SBC 1000-2000

It’s finally here!!!! PowerShell module for Sonus SBC 1000/2000. Well it’s not an official one, but one I created out of necessity when managing numerous SBC’s.

Key Features

  1. Built-in cmdlets to query Sonus SBC for transformation tables, transformation entries, systems information, etc.

  2. Built-in cmdlets to create transformation tables and transformation entries

  3. Built-in cmdlets to reboot and backup Sonus SBC

  4. Extensibility – Query, create, modify and delete any UX resource even the one’s which don’t have cmdlets associated!

  5. Scalability – Manage Sonus SBC’s at scale. Query, create, modify and delete resources with extraordinary efficiency. 1 or 100 SBC’s, it doesn’t matter!

  6. Simplicity – Extremely simple to use, logical cmdlet naming and in-depth built-in help.


  1. Sonus SBC software should be R3.0 or higher

  2. PowerShell v 3.0 or higher

  3. Ensure you have applied the base version 3.0 license which contains the license for REST

  4. Ensure you have created a username and password for REST. For more details check out: http://www.allthingsuc.co.uk/accessing-sonus-ux-with-rest-apis/

Getting Started

  1. Download the SonusUX PowerShell module from here

Copy the module to your machine. Ideally you want to copy the module to one of the following locations as these are default locations where PowerShell looks for modules when import-module is executed.

  1. C:\Users\YOURUSERNAME\Documents\WindowsPowerShell\Modules

  2. C:\Windows\system32\WindowsPowerShell\v1.0\Modules

Open PowerShell and import the module:

  1. If the module is in one of the above locations (where PowerShell searches), you can just execute import-module SonusUX

  2. If the module is not in the default location you can execute import-module C:\SonusUX\SonusUX.psm1 (replacing the path where you have copied the module to)

To discover what cmdlets are available execute: get-command –module SonusUX. Full PowerShell cmdlet help is available for all cmdlets.

The first cmdlet you need to use is connect-uxgateway. The screenshot below shows the complete syntax. Once connected you can start using other cmdlets.

Cmdlet Execution

Below is the output of some of the cmdlets:

Get call statistics from Sonus SBC


Get system information


Get transformation table


Get transformation table entries from a specified Transformation table

get-uxtransformationentry -uxtransformationtableid 11

Create Transformation table

new-uxtransformationtable -Description “LyncToPBX”

Create Transformation entry

new-uxtransformationentry -TransformationTableId 9 -InputFieldType 3 -InputFieldValue ‘(.*)’ -OutputFieldType 3 -OutputFieldValue ‘\1’ -Description “PassthroughCLI” -MatchType 0

Advanced Cmdlet Execution

And just to get you started, below are some Powershell one liners you can use to query multiple SBC’s!

Query number of calls currently up on the SBC’s

“lyncgwy1”, “lyncgwy2” | % { connect-uxgateway -uxhostname $_ -uxusername restuser -uxpassword Password01 ; (get-uxsystemcallstats).rt_NumCallCurrentlyUp}

Query the Hardware ID of the SBC’s

“lyncgwy1”, “lyncgwy2” | % { connect-uxgateway -uxhostname $_ -uxusername restuser -uxpassword Password01 ; (get-uxsysteminfo).rt_Chassis_Hardware_ID}

The below command will query the gateways in Lync topology and than query them for all the transformation tables

Get-CsService -PstnGateway | select -ExpandProperty poolfqdn | % { connect-uxgateway -uxhostname $_ -uxusername restuser -uxpassword Password01; write-host “`n$uxhostname” -ForegroundColor Green ;get-uxtransformationtable}

The below command will query the gateways in Lync topology and create backup of its configuration

Get-CsService -PstnGateway | select -ExpandProperty poolfqdn | % {connect-uxgateway -uxhostname $_ -uxusername restuser -uxpassword Password01; invoke-uxbackup -backupdestination c:\UXbackup -backupfilename $_ }

Copy transformation table entries from one transformation table to another on the Sonus SBC

get-uxtransformationentry -uxtransformationtableid 12 | Sort-Object sequenceid |%{ new-uxtransformationentry -TransformationTableId 1 -InputFieldType $_.inputfield -InputFieldValue $_.inputfieldvalue -OutputFieldType $_.outputfield -OutputFieldValue $_.outputfieldvalue -Description $_.description -MatchType $_.matchtype }

Copy transformation table entries from one Sonus SBC to another (Ok, now this certainly isn’t a one liner and I wouldn’t really recommened to use this method as it creates are new connection on destination Sonus SBC for every entry it creates from source, I rather prefer doing a little script, but hey, I just wanted to demonstrate how powerful this is!)

connect-uxgateway -uxhostname Sourcelyncgw1 -uxusername restuser -uxpassword Password01;get-uxtransformationentry -uxtransformationtableid 1 | Sort-Object sequenceid | % {connect-uxgateway -uxhostname Destlyncgw1 -uxusername restuser -uxpassword Password02;new-uxtransformationentry -TransformationTableId 1 -InputFieldType $_.inputfield -InputFieldValue $_.inputfieldvalue -OutputFieldType $_.outputfield -OutputFieldValue $_.outputfieldvalue -Description $_.description -MatchType $_.matchtype}

As you can see the possibilities are immense and hopefully this module will help you to be more efficient at deploying and managing Sonus devices. You can also quite easily extend the module (leverage get-command *-uxresource cmdlets to make your life easy!) and create advanced scripts using the existing cmdlets. Please feel free to provide any feedback or let me know what other cmdlets you would like to see in future updates or if you update the module please send me a copy to share with the community.



Follow me