Preparing for Teams: Cleaning up your old Response Groups

As part of my Preparing for Teams series, one of the things we need to consider depending on your migration strategy is cleaning up users in your On-Prem Skype for Business Response Groups.

By default when we Move a user from Skype to Teams or Disable the user account in Skype4B. The users SIP address still stays associated with any response groups they were a member of, slowing down the matchmaking service and creates 31137 and 31138 entries in your event log that look like this. (Stolen the image from Grieg till I grab my own)

In fact, this isn’t a new thing. Chris Williams blogged about it back in 2015 and it has been around for so long that I even remember Pat Richard dealing with it back in the day.

There are good scripts out there to detect and list these users (see Griegs one here) after the fact. But, what we really should be doing is correctly removing them when we offboard the user from the Skype environment.

As part of your offboarding/migration script use this little snippet to find any Response Groups the user is a member of, remove them from them and warn you if you need to assign someone else to keep answering calls as you expect.

#Skype User Offboarding Response Group Cleanup. UcMadScientist.com
#Define user account
$SipAddress = "[email protected]"
#Create an array of response groups containing the user
$RGSGroups = (Get-CsRgsAgentGroup | where {$_.AgentsByuri -contains "Sip:$SipAddress"})
#Run through the groups and remove the user
ForEach ($Group in $RGSGroups)
{
Write-output "User found in $($Group.Name). Removing…"
Try
{
[void]($Group.AgentsByUri.Remove("sip:$SipAddress"))
Set-CsRgsAgentGroup Instance $Group
Write-output "User removed from $($Group.Name)."
}
Catch
{
Write-error "Error: Something went wrong removing the user from $($group.name)"
}
#Check if we left the response Group Empty
if ($Group.AgentsByUri.Count -eq 0) {Write-Warning "$SipAddress was the last user in $($Group.name). This response group will not function until another user is added!"}
}
view raw Remove-CsRgsUser.ps1 hosted with ❤ by GitHub

Hope this helps.

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.