Monday, April 4, 2011

SharePoint 2010: PowerShell to delete a web part from the gallery

param($Identity = "", $Url = "")


$SPSite = New-Object Microsoft.SharePoint.SPSite($Url)

$SPWeb = $SPSite.OpenWeb()
$WebPartGallery = $SPWeb.Lists["Web Part Gallery"]
$gall = $WebPartGallery.Items select Name
$count = $gall.Count
for ($i =0; $i -lt $count;$i++)
if ($gall[$i] -match $Identity)
Write-Host "$Identity deleted"


lee woo said...

In the social jungle of human existence, there is no feeling of being alive without a sense of identity. See the link below for more info.


sarah lee said...

I really enjoyed reading your article. I found this as an informative and interesting post, so i think it is very useful and knowledgeable. I would like to thank you for the effort you have made in writing this article.