95,275 total views, 19 views today
In this troubleshooting, 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 root cause of this error and Fix:
The PowerShell module isn’t being imported into the Powershell console. You can add the module by running:
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.
You will not see the above error when,
- If you open the SharePoint 2016 Management Shell.
Note: It could be any versions of SharePoint from your environment.
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
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.
You may also like the following SharePoint PowerShell tutorials:
- How to start SharePoint list workflow using PowerShell
- How to hide quick launch menu in SharePoint online using PnP PowerShell
- Edit user Permission is greyed Out SharePoint Online
- Get workflow inventory from SharePoint online using PowerShell CSOM
- Create a modern team site using PnP PowerShell in SharePoint
- In 2 steps convert a classic SharePoint page to modern using PnP
- SharePoint Online: Delete All Files from document library for the given date – PowerShell CSOM
- Create SharePoint online list using PnP provisioning template
- SharePoint Automation: PowerShell script to get remote server information
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- SharePoint Online Automation – O365 – Upload files to document library using PowerShell CSOM
- SharePoint Online Automation – O365 – Create multiple items in a list using PowerShell CSOM
- SharePoint Online Automation – O365 – Update document library metadata using PowerShell CSOM