Cisco IP Phone Inventory Script


**Disclaimer: Use all scripts  with caution. I am posting what I personally used. I am not responsible for any issues you may have with the use of the following script.


Recently we came across an issue where we needed to verify all of our active IP Phones in the enterprise by serial number. There was no way that we could find to pull all of this information easily, so I got creative. I know we could have gone through each profile in CM to find it that way, or browsed to the web interface of each phone, but when you have a large amount of phones, that’s just not an option.

The following script is written in PHP. I tossed it on a web server and opened it in chrome. This script will go through and open the following URL for all addresses within a specified class-c network:


This will return some XML data in this form. No authentication is needed to open this as long as HTTP services are enabled. This is my 7960 from my home voice lab:

<Amps>5V Amp</Amps>

The script goes through and gathers this information for each address in the class C network of choice and then separates the “important” data for this specific cause. That includes the MAC Address, IP Address, and Serial Number. The output for the subnet is all displayed then right in the browser. There is no need to log in to each device or use any credentials. As long as the HTTP services are enabled on each phone and the URL above can be reached, you are good!

So here is the script in it’s entirety. Forgive me, I’m sure there may have been better ways to code this, but it works!

(It’s standard PHP and able to be edited easily if needed.)

In my case, I saved this as CM-serials.php. To actually run the script, I used the following url:


That will prompt the script to go through the subnet for addresses. You change the three octets on the end of the URL to specify the specific network you are focusing on. If you have something larger than a /24, you can just run the scan in multiple different scans (/23, etc). Obviously this will only return data for phones that are on the network currently, so you may have to run at different times of the day to get all of your devices. Once completed, here is what the output will look like:

Script Output

Blacked out the identifying information for security, but you get the point. There are three columns displayed with the applicable information. From there, you can clean up the data in Excel or something like Notepad++ to get in the specific format that you might need.


If there are any issues with the script, let me know and I’d be happy to take a look at the script to see what’s up, just comment below.


  1. I was able to get the scrip to run on a Linux box, but the output it only IP Addresses. Serial Numbers and MAC Addresses are blank. Did I miss something?


  2. I was able to run the script from a Linux server, however the output is only IP Addresses. I have not altered the code at all. Any ideas what the issue could be?


    • Sorry, I missed this comment. Make sure that http access is enabled on your phones in callmanager. If that is not enabled then the script won’t be able to pull any data and only the IP addresses will be shown as you mentioned.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.