Skype for Business Server – Script – Check if migrated to Cloud Voicemail

There doesn’t appear to be any obvious way to check if you have been migrated from Exchange Online UM to Cloud Voicemail in O365, other than calling your Voicemail box and checking to see if the announcement is different.

I have been through various settings in O365 Remote PowerShell for different customers and can’t find anything concrete (Sorry SfBo customers). SfB Server customers can use the Skype for Business Monitoring Reports to identify if users have been migrated. Calls diverted to Voicemail will show RTCC/ LyncTeamsGateway/1.1.319.0 rather than RTCC/ MSExchangeUM/15.20.2686.025. But that’s not very fun, so here is a script to do it for you:

$Days = 7
$domain = Get-CsSipDomain | Where-Object {$_.IsDefault -eq $True}

$Query1 = @"
FROM [LcsCDR].[dbo].[SessionDetailsView]

WHERE ToClientCategory = 'ExUM'
AND InviteTime BETWEEN DateAdd(DD,-$days,GETDATE() ) and GETDATE() 

$Query2 = @"
FROM [LcsCDR].[dbo].[SessionDetailsView]
WHERE ToClientVersion LIKE '%Teams%'
AND TargetUri LIKE '%$($'
AND InviteTime BETWEEN DateAdd(DD,-$days,GETDATE() ) and GETDATE() 

$Backends = Get-CsService -MonitoringDatabase | select PoolFqdn

Write-Host "Attempting to check Exchange UM vs CloudVoicemail useage for primary SIP domain $($" -ForegroundColor Cyan
Write-Host ""

Foreach ($BE in $Backends){

$um = Invoke-Sqlcmd -Query $Query1 -ServerInstance $BE.poolfqdn
$cvm = Invoke-Sqlcmd -Query $Query2 -ServerInstance $BE.poolfqdn

Write-Host "$($BE.poolfqdn)" -ForegroundColor Magenta
Write-Host "Exchange UM = $($um.Count)"
Write-Host "Cloud Voicemail* = $($cvm.Count)"
Write-Host ""

Write-Host "*Assuming calls to LyncTeamsGateway and TargetURI contains $($" -ForegroundColor Yellow

You should be able to run this from a Skype for Business Front End and as long as you have the Monitoring DBs deployed and SQL access it should work. By default it checks the last 7 days (variable in script) against all of your Monitoring DBs using your primary sip domain.

The SQL Query makes an assumption that if the ToClientVersion is LyncTeamsGateway and the TargetURI matches your SIP domain, then this is most likely a Cloud Voicemail call. If you don’t filter on TargetURI it will pull back results from Teams customers you’re federated with. Caveat, if you have some users in TeamsOnly mode, this could throw the script off. I couldn’t find a more accurate way unfortunately. You would see the UM count as “0” though as per my examples. Finding UM calls is easy, Microsoft made a ToClientCategory of ExUM, unfortunately we don’t have that luxury with CVM! Here are some example outputs from two customers.

SfBs 2015 customer with a Hybrid – Still using Exchange UM
SfBs 2019 customer with a Hybrid – Using Cloud Voicemail
SfBs 2015 customer with a Hybrid – Using Cloud Voicemail

Hope this helps, as always use at your own risk, test in a lab etc etc.

Leave a Reply

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


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