Jan 6, 2013

Add Users to SharePoint Group using PowerShell

#Get the site name to the variable
$web = Get-SPWeb SitURLHere
#Get the group name to the variable
$groupName = $web.SiteGroups["Group Name Here"]
#Assign user to variable
$user = $web.Site.RootWeb.EnsureUser(“User ID Here”)
#Add user to group 
$groupName.AddUser($user)
Write-Host -ForegroundColor green "User Added Successfully";

0 comments:

Post a Comment

Dear Readers,

I LOVE to hear from you! Your feedback is always appreciated. I will try to reply to your query as soon as possible.

1. Make sure to click the "Notify me" check box at the right side to be notified of follow up comments and replies.
2. Please Do Not Spam - Spam comments will be deleted immediately upon review.