Deploying and Activating Features in SharePoint 2010 with PowerShell

I was looking at an article on MSDN blogs today for customizing My Sites in SharePoint 2010. This post is not about that, but rather PowerShell that were there for deploying and activating a feature. Here is the text, direct from the site itself. This installs a feature (a), enables the feature (b), and then activates the feature on each site (c).

a.       Install-SPFeature -path "MyNewNavFeature"
b.       Enable-SPFeature -identity "MyNewNavFeature" -URL http://<mysitehost&gt; (Enables the new feature on the mysitehost)
c.       Enable the new feature on all personal sites:

$personalSites = get-spsite | where {$_.RootWeb.WebTemplate -eq "SPSPERS"}
foreach ($site in $personalSites) {Enable-SPFeature -Identity "MyNewNavFeature" -Url $site.Url}

 

The blog posting – where credit is due: http://blogs.msdn.com/b/spsocial/archive/2010/04/08/customizing-my-sites-in-microsoft-sharepoint-2010.aspx

%d bloggers like this: