Friday, June 7, 2019

Power shell to delete SharePoint Group

Dear start

 if ( (Get-PSSnapin -Name “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue) -eq $null ) {


    Add-PSSnapin “Microsoft.SharePoint.PowerShell”


}

$spSite = Get-SPSite "http://sp"

$groups=("Group1","Group2")

foreach($spWeb in $spSite.AllWebs)

{

$spGroups = $spWeb.SiteGroups

foreach($group -In $spGroups -and $group -NotIn $groups)

{

$spGroups.Remove($group)

}

$spWeb.Dispose

}

$spSite.Dispose


Thank you very much

          Fahadullah Karimi

         SharePoint Specialist




Page Layouts button was disabled for a publishing SharePoint page

1 comment:

  1. Hi there I am so thrilled I found your website, I really found you by mistake, while I was browsing on Yahoo for something else
    Sharepoint Development

    ReplyDelete