Errors while running SharePoint cmdlets in PowerShell

Are you trying to run a script for SharePoint in PowerShell and it throws the following error:

"The term <cmdlet name> is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."

Common cmdlets for Sharepoint in Powershell are: Get-SPSite, Get-SPWeb, Get-SPSolution, Get-SPWebApplication, Get-SPFarm, so the error above may have any of these SharePoint cmdlets in the error where it says <cmdlet name>.

A common cause of this error is that the snapin for SharePoint is not currently loaded in your PowerShell session. In order to fix this run the following command:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

This loads the SharePoint cmdlets for PowerShell, allowing you to do many different things with your SharePoint farm through PowerShell.

Test to see if that fixes your problem by running a simple SharePoint Powershell cmdlet like the following:


That should list all the solutions you have on your farm. If that runs without errors you are good to go!

Note: You can leave out the '-ErrorAction SilentlyContinue', all that does is hide an error that may be thrown if the snapin has already been loaded. I usually only add '-ErrorAction SilentlyContinue' if I am creating a script that is ran from a ps1 file where the PowerShell SharePoint Snapin is already loaded because I may run the file it multiple times.