Issue
We are having SharePoint on Windows Server 2008 but when we are trying to run SharePoint commands from PowerShell we are getting below error message.
Resolution
Run below commands in PowerShell to register SharePoint in PowerShell & try again.
Remove-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue