How to update SharePoint’s Group Owner using PowerShell

#Enter the site URL for which the group owner needs to be updated
$webUrl = “http://test.company.com/man”

Write-Output “Getting site object”
$web = Get-SPWeb $webUrl
Write-Output “Success”

Write-Output “Getting User Group”
$spGroups = $web.groups
#Get the owner group
$UserGroup = $spGroups | where {$_.Name -eq “User”}
Write-Output “Success”

foreach($group in $spGroups)
{
if($group.Name.StartsWith(“User”))
{
Write-Output “Updating owner of group – $group”
$group.Owner = $UserGroup
$group.Update()
Write-Output “Successfully updated”
}
}

$web.Dispose()
Write-Output “script ended”

NGenious Solutions