This SharePoint tutorial explains how to fix the term ‘get-spweb’ is not recognized as the name of a cmdlet function PowerShell SharePoint error that 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 using PowerShell, I was running the below command:
$SPWeb = Get-SPWeb "http://win-pfcp2dgt8di/sites/EnjoySharePoint/"
The error can also come in SharePoint 2013, SharePoint 2016 or SharePoint 2019 version.
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
- 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 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:
- Remove-SPOSite Access denied. You do not have permission to perform this action or access this resource in SharePoint Online
- Missing argument in parameter list PowerShell
- connect-sposervice : the remote server returned an error: (403) forbidden.
- Exception calling ExecuteQuery with 0 argument(s): Unable to connect to the remote server error in PowerShell SharePoint Online
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 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