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

Recently after installing SharePoint Search Express 2010 on one of my clients test servers and on running SharePoint 2010 Management Shell I got the following error “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered”.

After checking the logs in 14 hives, I found that the current logged in user was not having sufficient rights on the SharePoint configuration DB. After providing the db_owner and SharePoint_Shell_Access rights i was able to start use the SharePoint Management Shell.

However a friend of mine who faced similar problem was not successful in get the SharePoint 2010 Shell running even after providing appropriate rights in SQL, but a quick way to make it work was to run the Shell as an Administrator.