PSScript: Get Phone Registration from Log files

Recently a customer requested to get a phone inventory, usually we can simply use the Skype for Business Monitoring Report:

The issue was that customer had around 6000 phones and this report is limited to 1000 (by design).

One option could be change the SQL Stored Procedure that is executed when we run the IP Phone Inventory Report. This wasn’t an option since it would be an unsupported change.

We ended up looking at the phone update logs in the Skype for Business file share that is located in:

\<SfB File Store>\<X>-WebServices-<X>\DeviceUpdateLogs\Server\Audit\imageUpdates

In this files we have the following details:

Logging DateTime,
User Name,
User Host Address,
Device Type,
Request DateTime,
Mac Address,
Serial Number,
Vendor,
Model,
Revision,
Locale,
Requested,
Response

Note: In bold are the fields that customer requested.

Initially, we developed a simple C# application that would read all files. The application was fast to read all files and returned the unique phones. The downside was that this was an unsigned executable and customer won’t be able to execute it.

We then decided to focus on converting the C# application to PowerShell Script. This took a bit more time but in the end we manage to get the same output with the PowerShell Script.

The script is available at GitHub:

GitHub – uclobby/Get-CsPhoneReportFromUpdateLogs

Usage:
Get-CsPhoneReportFromUpdateLogs.ps1

-LogFolder (required)
We need to specify the update log locations, this can be local or network share.

-OutputFile (optional)
This allows to specify a different output file, the default is in the script location.

-Days (optional)
By default the script reads files newer than 30 days. 

Finally, an example of the expected output: