The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered

The SharePoint 2010 Management Shell shot me this message earlier this week. I was logged on as a local administrator and farm administrator to boot. I was able to manage the farm using the Central Administration site PowerShell simply refused to load the cmdlets.

PSNotAccessable

This warning is displayed when the logged in account does not have the correct permissions. When you get this warning as show above the simple solution is log in as someone with the appropriate permission – like the setup or farm account and run the Add-SPShellAdmin cmdlet supplying the user name as a parameter. For example to add Dbgdemodbishop as a Shell Admin I would run:

Add-SPShellAdmin -UserName dbgdemodbishop

addSPShellAdmin

To determine which accounts are Shell Admin accounts use Get-SPShellAdmin as shown below.

getspshelladmin

The Add-SPShellAdmin cmdlet will add the account to the correct database and windows groups. This can all be done manually but it is genreally easier to run the Add-SPShellAdmin cmdlet under an account that can run the managment shell. Once the account has been added as Shell Admin you can switch back the user and PowerShell should load the cmdlets.

What can be confusing is the fact that administrators can manage the farm using the Central Administration pages but not using the managment shell. Why is that? When administrators manage the farm using Central Administration pages they are accessing the farm using the Central Administration’s app pool account – which has all the necessary privillages on the local macine and the databases. When working with SharePoint using the managmemnt shell there is no app pool to get between the administrator’s account and the farm. The account requires the permissions.

To get more deeper into the hows and why’s check out Zac’s blog post on the topic:
http://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=56