About Me

Having 12 years experience in Microsoft technologies.Since more than 7 years working in SharePoint technologies. Expert in providing consultation for SharePoint projects. Hands on with development and administration.

Wednesday, 22 February 2012

Powershell script to get Orphaned SharePoint 2010 web templates from Site collection

Problem - In SharePoint 2010, when you save site as a template, it will be saved as a .wsp file and you can find all web templates in site collection solution gallery. What if, we delete solution without deactivating? so deleted objects became a orphan. How to get find orphaned web templates?

Soltion: We can't get orphaned items from solution gallery when you retrive through Object model. Then, how to get? Using powershell command Get-SPFeature of site collection we will be getting all installed & orphned features. In this case, the web template also stored as a feature. Once you get the feature id, use stsadm or powershell command to deactivate. that't it. You can automate same script to process @ farm/web appliaction level.

Here is the detailed info.

run in sharepoint powershell console.

Get-SPFeature -site XXXXXXX

sample out put
get the required feature id and using stsadm -o deactivatefeature command to deactivate the same.

Happy programming....

1 comment: