I figure I’d write this quick post moreso for remembering sake than anything else….
We are in the middle of creating deployment scripts for our SharePoint Development cycle. Today we have the task of enabling various different features using PowerShell. A good site to view various different powershell syntax can be found here:
One of the tasks we needed to do was to enable some of the standard SharePoint features, such as the SharePoint Enterprise Features explained here.
Well naturally we decided to place these features inside a web site template, and then upon deployment run a powershell script to apply the web template to the site as found in this code below:
However upon running the script we ran into some errors. These errors were dealing with individual features not being enabled for various reasons. We wanted to test individual features being enabled using PowerShell. Question is, how do you determine some of the SharePoint Features Out of the box, because they are not named according to anything that make sense…
Take a look:
What’s the name of the above feature? It’s not: SharePoint Server Enterprise Site Collection It’s actually named PremiumSite.
So How do you figure out some of the others?
Well this is what I did. I knew from google that one of the features I was interested in was the SharePoint Enterprise Features thus I started there. From google I learned that this feature can be found in the Folder: C:\program files\common files\microsoft shared\web server extensions\14\template\features\PremiumSite.
When I went to this location I found this file:
Notice above the value for Title and Description. These values use the embedded resource mechanism of the .Net Framework, and the Resources token to get exactly what these names mean. Thus I went searching, the file, osrvcore either had to be an assembly or a resource file that could dynamically be converted into an assembly at runtime, so I searched my computer.
What I found was a file in this directory:
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\Resources
The file name osrvcore.en-US.resx was just the file I was looking for. I opened this file up and saw all the names of the Out of the box SharePoint Features, and where they point to feature folder wise.
In this resource file, the name of the feature found in the c:\program files\common files\microsoft shared\web server extensions\14\template\features will be PremiumSite minus the suffix “FeatureTitle”.
Now we can write a powershell script such as this to get this and related features, and also enable them such as this: