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
Please, change the URL of the web
Please, change the "OwnerGroupName" to your respective group name.
Instead of user, you can also assign a group for members, change the "domain\username"
#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
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.