Current user is not a farm administrator - redux

Tue, Feb 5, 2013 One-minute read

A while ago, I posted about an issue with deploying a custom SharePoint retention policy where activating a feature was failing due to a permissions issue.

I fell over this issue again recently, but despite following all the advice in that post, I still couldn’t get things to activate and I didn’t really want to start giving all known service accounts local admin and DBO on everything in sight. So instead, I used a quick Powershell workaround. This works because PS always runs in the context of the Farm Admin, so I assumed it must have the relevant permissions. This script will find the feature you want to activate, and then activate it. Success is no message returned!

[code]
Get-SPFeature | where {$_.DisplayName -like ‘Yourfeat*} | Enable-SPFeature -url http://yoururl
[/code]

Just ensure Get-SPFeature only returns a single feature.