Search This Blog

Wednesday, December 10, 2014

Remove spgroups using powershell.

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.

No comments:

Post a Comment

Restricting Custom People Picker to only one Sharepoint group programatically

Refer the following script files in your page,     <!-- For People Picker -->     <script type="text/javascript" src...