In this blog, you will see how to remove a user from a specific Yammer group using PowerShell.
Prerequisites
Go to https://www.yammer.com/client_applications and register an app.
Once the app is registered, generate a developer token.
Copy the below script and paste it in a notepad. Save the file as RemoveUser.ps1.
- # Input Parameters
- $developerToken = "12240-*****iPR2NWpZVtnbXYw"
- $groupID="15653442"
- $userID="1541035765"
- $uri="https://www.yammer.com/api/v1/group_memberships.json?group_id=" + $groupID + "&user_id=" + $userID
- $headers = @{ Authorization=("Bearer " + $developerToken) }
-
- # Invoke Web Request - Remove the user from Specific group
- $webRequest = Invoke-WebRequest –Uri $uri –Method Delete -Headers $headers
Open PowerShell window and run the following command.
folderlocation – RemoveUser.ps1 file location
Run the following command,
Thus in this blog, you saw how to remove a user from specific Yammer group using PowerShell.