How can i set existing SharePoint Group as Group Owner (instead of SPUser, set SPGroup as owner) using PowerShell at the time of creation of new Group?

Use the below code,

Add-PSSnapin Microsoft.SharePoint.PowerShell

$web = Get-SPWeb URL
$GroupName = "GroupName"
$Ownergroup = $web.SiteGroups["OwnerGroupName"]
$Description = "Enter the description"
$member = $web.SiteUsers["domain\username"]
$web.SiteGroups.Add($GroupName, $Ownergroup, $member, $Description)
$web.Update();

Remove-PSSnapin Microsoft.SharePoint.PowerShell

Note:

  1. Please, change the URL of the web

  2. Please, change the "OwnerGroupName" to your respective group name.

  3. Instead of user, you can also assign a group for members, change the "domain\username"

  • Please feel free to mark it as answer, if it has helped you because it might help someone in future too :) . For more information, please drop a comment, – Karthik Jaganathan Jan 19 '16 at 7:58
#Get the SPWeb
$web = Get-SPWeb http://url_to_web

#Get the Group
$group = $web.SiteGroups["Target Group Name"]
$existingGroup = $web.SiteGroups["Existing Group Name"]

#Assign that user as the owner
$group.Owner = $existingGroup

#Update the Group
$group.Update()

Ideally this should be enough for it. If doesn't work, type cast $existingGroup group as a user. and assign to the $group.Owner

I am assuming both groups are already created, and you are updating permissions now.

PS: It is not tested since I don't have test environment available right now to test it.

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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