Back to blog
Blog , How-To

Automatic Bulk Deprovisioning of Users in CUCM and Unity

Benoit Desnoyers
February 22, 2018

Hi, I’m Benoit, one of the new guys on Stack8’s Incident Management team. Our team is always looking for new ways to improve our process in an effort to make things better and easier for our customers. Today I will explain how we leveraged the SMACS API to automate deprovisioning requests in Cisco CUCM and Unity. 

It started at the end of last quarter when we received a request from one of our Managed Services customers. They had just completed a full check of their infrastructure and had found a list of more than 300 users who had not been appropriately decommissioned and as a result had many lingering devices floating around in the system.  They asked us to purge their infrastructure of all these unused devices, services and voicemails within a very short timeframe. 

Before sending this list of users to one of our Level 1 technicians, we took a moment to weigh all of our options. We determined that we could follow these possible courses of action:

  • Delete each respective device, service, and voicemail manually through Call Manager and Unity.
  • Delete each respective device, service, and voicemail manually through SMACS.
  • Build a custom SQL command to run on CUCM or Unity.
  • Create a list of BAT files containing all devices, services, and voicemails to delete.

After review, we concluded that any one of these options would tie up our resources for at least two days. It was at this moment that one of our developers chimed in and insisted that we could easily script some functions to leverage the SMACS API to perform all the heavy lifting for us within minutes. 

By leveraging my very rusty Python skills, I was able to build a very powerful yet simple script that could parse a CSV file containing a list of users to be de-provisioned. For each user in the list, the script would sweep the customer’s UC environment and delete all phones, voicemails, softphones, iPhones, Androids and End User IM and Presence accounts associated with the user.


Delete Flowchart 2.png

As you’ll notice above, even if the user was no longer part of the organization’s LDAP directory and no longer in CUCM or Unity, the script had an option to also look at device descriptions containing the user’s first and last name and flag those devices for deletions as well. 

At Stack8 we believe that there is a better way for everything. The example I shared with you today is just one of many examples of how we are always learning and never remain satisfied. If you share this passion and enjoy what you read, be sure to take a look at our Job Opportunities. 

Alternatively, if you would like to inject some of our know-how into your business,  be sure to check out our Managed Services page as well as the SMACS Provisioning Tool page.

Ready to take your unified communications from headache to hassle-free?

No throwing darts at proposals or contracts. No battling through the back-end. No nonsense, no run-around.