Sometimes we have to develop an automatized routine that must run in an specific schedule in your SharePoint site. This routine must complete some tasks, send e-mails, whatever… you name it! That’s why we develop SharePoint Timer Jobs and they work quite well.

If you know how they work, you probably know they are usually deployed with a Feature Receiver that adds to the Farm during the deployment process.

But let’s say if your SharePoint administrator forgot to activate it and you had to do it manually. Or if you are in an development environment and you want to debug the Feature receiver to find a bug.

So you are browsing to the Manage Features page, you find the feature and then suddenly an exception happens presenting a message of Access Denied!

Well, that happened because you are probably accessing from a remote machine and SharePoint doesn’t allow that changes are made to Administration objects from outside the server like your personal computer.

To overcome that issue, you can just run this code below and you will be able to enable the feature without problems:

Some observations!
1) It’s not recommended to run this snippet in production environment, due security issues
2) The account enabling the feature must have access like the System Account;
3) The “Access Denied” message won’t show up if you enable the feature by Powershell.

References:
Paul Kotlyar’s .NET Adventures
Microsoft