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

When I am trying to run powershell window for the first time after installing SharePoint 2010 I was faced with a message that

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

Then, I did Bing search for some time and found the solution and the same I want to post here, so that it may be useful for some one.

Solution: Make sure that the logged in user account has db_owner and SharePoint_Shell_Access rights to SharePoint_Config database

Granting rights to the user account

Granting rights to the user account