Remove spgroups using powershell.
When you delete a site spgroups for that site will remain in webapplication itself. So we have to remove that spgroups manually. Otherwise it will return "Group name already exist" exception when you create a spgroup with same/old name.
$spWeb = Get-SPWeb "Web Url"
$spGroups = $spWeb.SiteGroups
$groups = ("MID-10000-Owners", "MID-10002-Visitors","MID-10003-Members")
ForEach($group in $groups) {
$spGroups.Remove($group)
}
$spWeb.Dispose()
This will help you to remove spgroups using shell command.
When you delete a site spgroups for that site will remain in webapplication itself. So we have to remove that spgroups manually. Otherwise it will return "Group name already exist" exception when you create a spgroup with same/old name.
$spWeb = Get-SPWeb "Web Url"
$spGroups = $spWeb.SiteGroups
$groups = ("MID-10000-Owners", "MID-10002-Visitors","MID-10003-Members")
ForEach($group in $groups) {
$spGroups.Remove($group)
}
$spWeb.Dispose()
This will help you to remove spgroups using shell command.
No comments:
Post a Comment