Bulk Remove User(s) from Response Group(s) with Powershell

Removing users from Response Groups can get tedious using the SfB or Lync Control Panel. It’s also a bit tedious to use the builtin ‘Cs’ Powershell commands.

I made a short script which which takes any number of users and removes them from any number of groups. If you want to skip this post and just get on with it, you can check out ‘Remove-RgsMember’ here: https://github.com/matthew-hickok/sfb-tools/blob/master/Remove-RgsMember.ps1

(my Github page is pretty sad right no but I’ll be migrating all my code from BitBucket soon)

You can see how to use it by just using the ‘Get-Help’ command, but there is nothing fancy here. The’User’ string parameter can take pipeline input, meaning you can pipe SIP addresses to it however you see fit.

This can also be used as part of an off-boarding process for employees.

Examples

Remove two users from every RG they are a part of

tim@domain.com,joe@domain.com | Remove-RgsMember -AllGroups

Filter for specific SfB properties and remove them all from a specific RG

Get-CsUser -Filter {RegistrarPool -eq "fepool01.domain.com"} | select SipAddress -ExpandProperty SipAddress | Remove-RgsMember -ResponseGroup RG01

Remove a single user from three RGs

Remove-RgsMember -User joe@domain.com -ResponseGroup RG01,RG02,RG03 -Verbose

Remove a list of users in a text file from all RGs

Get-Content .\myUsers.txt | Remove-RgsMember -AllGroups

One thought on “Bulk Remove User(s) from Response Group(s) with Powershell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s