Update SharePoint Group with group owner using Power Shell script.


I am updating SharePoint site collection group owner with user in first case, in second case updating group owner with group.

Case 1:

 Group owner updating with user.

#Get the SPWeb
$web = Get-SPWeb “http://SP2010:8080/sites/TestSite”

#Get the Group
$group = $web.SiteGroups["Project Managers"]

#Get the User
$user = $web.EnsureUser("globaldomain\e939383;")

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

#Update the Group
$group.Update()


Case 2:

 Group owner updating with GroupName.

#Get the SPWeb
$web = Get-SPWeb “http://SP2010:8080/sites/TestSite”

#Get the Group
$group = $web.SiteGroups["Project Managers"]

#Get the group name
$group =$web.SiteGroups["Project Managers"]

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

#Update the Group
$group.Update()



in this second case "Project Managers" has the full control on that group. But in first case "globaldomain\e939383;" only has the full control on that group.







Comments

Popular posts from this blog

Sending email using Powershell script

Convert List Collection to DataTable using C#

Difference Between Site Template and Site Definition