[Solved] Fix the "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function" PowerShell error

[Solved]: “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error

2 comments

 97,750 total views,  3 views today

In this “The term ‘Get-SPWeb’ is not recognized” troubleshooting article, I will share how to fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error. Many times, we may notice even though we pass the correct URL to the Get-SPWeb command as an Identity parameter, still, we could see the error – “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function….”

For example, once we try to run the below Get-SPWeb command,

$web = Get-SPWeb “http://server:port”

We will get the below error:

The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function
The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function

The root cause of this error and Fix: The term ‘Get-SPWeb’ is not recognized

The PowerShell module isn’t being imported into the Powershell console. You can add the module by running:

[Solved] Fix the "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function" PowerShell error
Fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error

Add-PSSnapin Microsoft.Sharepoint.Powershell

Once we add the “Add-PSSnapin Microsoft.Sharepoint.Powershell” command, then if we run the same Get-SPWeb command, we will not get that error.

The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function
The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function

You will not see the above error when,

  • If you open the SharePoint 2016 Management Shell.

Note: It could be any version of SharePoint from your environment.

PowerShell Management Console In SharePoint 2016
PowerShell Management Console In SharePoint 2016

However, we will face the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” error when we open the below PowerShell console or editor:

  • Windows PowerShell
  • Windows PowerShell ISE

Summary: The term ‘Get-SPWeb’ is not recognized

Thus, in this SharePoint PowerShell troubleshooting, we have learned about how to fix the “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” error.

See Also: SharePoint PowerShell tutorial

You may also like the following SharePoint PowerShell tutorials:

About Post Author

2 comments on “[Solved]: “The term ‘Get-SPWeb’ is not recognized as the name of a cmdlet, function” PowerShell error”

Do you have a better solution or question on this topic? Please leave a comment