the term ‘get-spweb’ is not recognized as the name of a cmdlet

Recently, I got an error while working with PowerShell SharePoint, and the error came as “the term ‘get-spweb’ is not recognized as the name of a cmdlet”. In this tutorial, I will explain how to fix the error “get-spweb not recognized“.

the term ‘get-spweb’ is not recognized as the name of a cmdlet function

Recently, while working with SharePoint using PowerShell, I was running the below command:

$SPWeb = Get-SPWeb "http://win-pfcp2dgt8di/sites/EnjoySharePoint/"

The error can also be found in SharePoint 2013, SharePoint 2016, or SharePoint 2019.

I got an error that says:

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:10

  • $SPWeb = Get-SPWeb “http://win-pfcp2dgt8di/sites/EnjoySharePoint/”
  • ~~~~~
    • CategoryInfo : ObjectNotFound: (Get-SPWeb:String) [], CommandNo
      tFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
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 error was coming because the PowerShell module isn’t being imported into the Powershell console.

Below is the code we can write to add the PowerShell SharePoint snap-in.

Add-PSSnapin Microsoft.Sharepoint.Powershell

After you add the “Add-PSSnapin Microsoft.Sharepoint.Powershell”, the Get-SPWeb command will work fine.

The full commands look like below:

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

After this the error PowerShell the term ‘get-spweb’ is not recognized as the name of a cmdlet will not come. It will fix the below issues:

  • the term get-spweb is not recognized
  • 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 script
  • the term get-spweb is not recognised
  • the term ‘get-spweb’ is not recognized as the name of a cmdlet fu

You may also like:

>
Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial

FREE Power Platform Tutorial PDF

Download 120 Page FREE PDF on Microsoft Power Platform Tutorial. Learn Now…