In SharePoint site you can see usually a lot of groups. Sometimes administrator gets a task to add user to several groups. If it’s 3-5 groups you can do it manually, but if you need to add user to 30 groups? I’m too lazy to do it manually and too smart not do it at all.

PowerShell Script will help us. But because this script is more than one string I’ll use PowerShell ISE (read about how to add it in How to add PowerShell ISE from PowerShell).

So let’s start out PowerShell ISE and connect SharePoint CMD-let:


Let’s enter site collection url, username for inserting to groups and get array of destination SharePoint groups. For example, let this groups contain a string "admin"


Go through each element of array and add user to SharePoint group


And if you made a false and, for example, entered wrong username, you can easily remove user from SharePoint groups with this PS-code:


If you don’t want to collect these pieces here’s a full version:


If there are non-english letters in a group name or if the group you need is on another site (but in this site collection), then you can have error on Set-SPUser command. In this case I can advice you to use another command $web.SiteGroups[group name].AddUser(user)