Following is my command : Remove-SPUser -Identity 'i:0#.w|sp13\TestUser' -Web 'http://spserver-sp13/sites/TesSite' -Group 'Testme11' -Confirm:$False

Here group Testme11 is a group without permission, when I execute above command from powershell, sharepoint server removes the user from the above mentioned group as well other groups (groups with permission) that user is part of.

But when we use above command for removing a user from a group with permission, it just removes it from the intended group.

hence please let me know if this is a bug ?


You could use the following command to remove the user from specific group:

$web=Get-SPWeb http://spserver-sp13/sites/TesSite
Remove-SPUser -Identity 'i:0#.w|sp13\TestUser' -Web $web -Group $group -Confirm:$False
| improve this answer | |
  • but my command works as expected when i use a group with permissions, why does it weirdly remove user from every group when a group without permissions is present in the command. – Nitish Lokhande Jun 12 '19 at 10:20
  • Per my test, I find that group without permission in SharePoint would not exist in powershell. When use $web.groups command, you would not find the group without permission. So I guess in your command, it would remove the users from this site because it cannot find this group. – Michael Han_MSFT Jun 13 '19 at 9:09
  • Thanks a lot Michael for your explanation! – Nitish Lokhande Jun 17 '19 at 6:20
  • Please accept it as answer if it helps you. – Michael Han_MSFT Jun 17 '19 at 6:23
  • Hi Michael, Please can you let me know on how can i utilize the $web in c# application – Nitish Lokhande Jun 21 '19 at 5:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.