I was trying to put my hands around PowerShell and I was encounring a strange error. I was running one cmdlet Get-SPWebApplication in Windows Server 2008 Server and it was throwing this error:
"Cannot access the local farm. Verify that the local farm is properly configured, currently available, and that you have the appropriate permissions to access the database before trying again."
I tried all the cmdlets but the same error keep coming. After some more investigation I found that the solution and it was that the PowerShall needs to be executed as Administrator. While running powershell it shows 2 option:
If we just click the open it will open a PowerShell window and this message will come: