This SharePoint tutorial explains, how to fix the term ‘get-spweb’ is not recognized as the name of a cmdlet function PowerShell SharePoint error which comes while running the get-spweb cmdlet.
How to fix the error the term ‘get-spweb’ is not recognized as the name of a cmdlet function? To fix the issue just add Add-PSSnapin Microsoft.Sharepoint.Powershell PowerShell snap-in.
the term ‘get-spweb’ is not recognized as the name of a cmdlet function
Recently, while working with SharePoint 2016 using PowerShell, I was running the below command:
$SPWeb = Get-SPWeb "http://win-pfcp2dgt8di/sites/EnjoySharePoint/"
The error can also come in SharePoint 2013 or SharePoint 2019 version.
I got an error which 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
- CategoryInfo : ObjectNotFound: (Get-SPWeb:String) [], CommandNo

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 looks like below:
Add-PSSnapin Microsoft.Sharepoint.Powershell
$SPWeb = Get-SPWeb "http://win-pfcp2dgt8di/sites/EnjoySharePoint/"
You may like following PowerShell tutorials:
- How to create a communication site in SharePoint using PowerShell
- How to connect SharePoint Online using PnP PowerShell
- Save list as template in SharePoint Online using PowerShell
- PnP PowerShell Commands for SharePoint Online List
- How to remove SharePoint Online Site Collection Administrator using PowerShell
- Get SharePoint document library size using PowerShell
- Connect-PnPOnline : The ‘Connect-PnPOnline’ command was found in the module ‘SharePointPnPPowerShellOnline’
- PowerShell SharePoint Online: The remote server returned an error: (403) Forbidden
- Remove all items from a SharePoint Online list using PnP PowerShell
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
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com