{"id":1771,"date":"2013-05-07T11:44:26","date_gmt":"2013-05-07T11:44:26","guid":{"rendered":"https:\/\/poiseddevelopers.com\/reality-tech\/?p=1771"},"modified":"2024-04-26T12:57:16","modified_gmt":"2024-04-26T12:57:16","slug":"feature-reporting-and-deactivation-across-a-sharepoint-farm","status":"publish","type":"post","link":"https:\/\/poiseddevelopers.com\/reality-tech\/feature-reporting-and-deactivation-across-a-sharepoint-farm\/","title":{"rendered":"Feature Reporting and Deactivation across a SharePoint Farm"},"content":{"rendered":"<h2>Reporting on features across a SharePoint Farm<\/h2>\n<p>Before retracting a SharePoint solution, it is best to deactivate the associated feature in each Site Collection. Here\u2019s a script that reports on which Site Collections have a feature enabled, and optionally deactivate the feature. This is easily adapted to Web or Web Application features as well. Best is to first get the SPFeature GUID, using get-spFeature CmdLet. Just flip the $Deactivate switch to $true to actually deactivate. Note any SPFeature not found will generate an error that a try\/catch clause will not catch. The quick solution is to capture my output into $OutLine, and clear the console and output the summary at the end of the run.<\/p>\n<pre lang=\"php\">\r\n$OutLine=$null;\r\n$Deactivate = $false;\r\n$a=Get-SPFeature 359d84ef-ae24-4ba6-9dcf-1bbffe1fb788     #my site collection feature, substitute for yours\r\n \r\nGet-SPWebApplication | Get-SPSite -Limit all | % {\r\n$b = Get-SPFeature -Identity 359d84ef-ae24-4ba6-9dcf-1bbffe1fb788     -site $_.url\r\n \r\nif ($b -ne $null)\r\n{\r\n    $OutLine = $OutLine + \"Found active in $($_.url)`n\"\r\n    $b=$null;\r\n    if ($Deactivate)\r\n    {\r\n        Disable-SPFeature 359d84ef-ae24-4ba6-9dcf-1bbffe1fb788 \u2013url $_.url\r\n    }\r\n}\r\n \r\n}\r\ncls\r\nif ($Deactivate)\r\n{\r\n    Write-Host \"Deactivated all; Here are Site Collections where it was active:\"\r\n}\r\nelse\r\n{\r\n    Write-Host \"Here are Site Collections where it is active:\"\r\n}\r\nwrite-Host $OutLine\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Reporting on features across a SharePoint Farm Before retracting a SharePoint solution, it is best to deactivate the associated feature in each Site Collection. Here\u2019s a script that reports on which Site Collections have a feature enabled, and optionally deactivate the feature. This is easily adapted to Web or Web Application features as well. Best [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":1773,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[26],"tags":[],"class_list":["post-1771","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"_links":{"self":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/comments?post=1771"}],"version-history":[{"count":1,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1771\/revisions"}],"predecessor-version":[{"id":1774,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1771\/revisions\/1774"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media\/1773"}],"wp:attachment":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media?parent=1771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/categories?post=1771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/tags?post=1771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}