Steps
Start your Windows PowerShell on your computer.
Right click and select Run as administrator option.
Paste the below script on the PowerShell window and click the enter button.
Check your SharePoint site Feature will activate successfully.
Syntax Explanation
Delete-SPGroup "http://gowtham.sharepoint.com/teams/tutorials" "SharePointOwners"
This example deletes SharePoint group "SharePointOwners" at the given site collection
- Code:
-
- Function Delete-SPGroup()
- {
-
- [CmdletBinding()]
- Param(
- [Parameter(Mandatory=$true)][string]$SiteURL,
- [Parameter(Mandatory=$true)]$GroupName
-
- )
-
- #Get the rootweb
- $web = Get-SPWeb $SiteURL
-
- #group already exists
- if($Web.SiteGroups[$GroupName] -ne $null)
- {
- #remove sharepoint group using powershell
- $web.SiteGroups.Remove($GroupName)
- $web.Update()
-
- Write-Host "Group Deleted!"
- }
- else
- {
- Write-Host "Group doesn't Exists!"
- }
- $web.Dispose()
- }
- Delete-SPGroup()