[Solved] The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program error in SharePoint PowerShell

This SharePoint PowerShell tutorial explains, how to solve The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program error which comes in PowerShell SharePoint 2013/2016/Online.

Recently when I am trying to run the below PowerShell Cmdlet:
$web = Get-SPWeb “http://win-pfcp2dgt8di/sites/EnjoySharePoint/”

I got the error saying:
Get-SPWeb : The term ‘Get-SPWeb’ 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.
At line:1 char:8
+ $web = Get-SPWeb “http://win-pfcp2dgt8di/sites/EnjoySharePoint/”
+        ~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Get-SPWeb:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

The error looks like below fig:

The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program
The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program

The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program error

The error usually comes if you directly run the command in the Windows PowerShell Console.

To resolve to execute the below command first:

Add-PSSnapin Microsoft.Sharepoint.Powershell

Ideally, we should run in SharePoint 2013 Management Shell rather than only in the PowerShell console. So Open SharePoint 2013 Management Shell in Administrator mode and then run the Cmdlet the error will not come.

The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program
The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program

If you are using the Windows PowerShell ISE to run, debug or test PowerShell cmdlets, then you can write the script like below:

Add-PSSnapin Microsoft.Sharepoint.Powershell
$web = Get-SPWeb “http://win-pfcp2dgt8di/sites/EnjoySharePoint/”

If you are new to PowerShell SharePoint, then I have written a detailed article on how to working with PowerShell in SharePoint Online/2016/2013.

SharePoint Online management shell Error: The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet

If you are getting the error in SharePoint Online and you are writing the PowerShell script like below:

$web = Get-SPWeb “https://onlysharepoint2013.sharepoint.com/sites/bhawana”

When you execute the above line, you will get The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function script file or operable program error.

Because Get-SPWeb cmdlet is not for SharePoint Online. It is only for SharePoint on-premise versions.

To work with PowerShell in SharePoint Online, then you should follow PowerShell SharePoint Online cmdlets or PnP PowerShell cmdlets.

You may like following SharePoint PowerShell tutorials:

After this, The term Get-SPweb is not recognized as the name of a cmdlet function script file or operable program error will not come.

Donwload Hub site pdf

Download SharePoint Online Tutorial PDF FREE!

Get update on Webinars, video tutorials, training courses etc.

  • >