Powershell Error "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function..."
134,435
Solution 1
I think this need to be run from the Management Shell rather than the console, it sounds like the module isn't being imported into the Powershell console. You can add the module by running:
Add-PSSnapin Microsoft.Sharepoint.Powershell
in the Powershell console.
Solution 2
Run this script from SharePoint 2010 Management Shell as Administrator.
Author by
LifeScript
Updated on November 22, 2020Comments
-
LifeScript over 3 years
I just typed the follow to try and get my SharePoint site:
$spWeb = Get-SPWeb -Identity "http://nycs00058260/sites/usitp"
It gave me the following error
The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function, script...
The url is correct so why am I getting this error?
-
LifeScript over 11 yearshi, I have a small question, how to check if the file already exists in sharepoint lib?
-
Lennon about 9 yearsGreat! This allow us to use Windows PowerShell ISE for SharePoint related stuff, which is much better as it support multi-line functions and has syntax validation!
-
Eliezer about 6 yearsif ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorActionSilentlyContinue) -eq $null) { Add-PSSnapin "Microsoft.SharePoint.PowerShell" }
-
Harsha Vardhini over 5 yearsHi, I am getting error while running the mentioned command. Please check this error:Add-PSSnapin : No snap-ins have been registered for Windows PowerShell version 4. At line:1 char:1 + Add-PSSnapin Microsoft.Sharepoint.Powershell + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (Microsoft.Sharepoint.Powershell:String) [Add-PSSnapin], PSArgumentException + FullyQualifiedErrorId : AddPSSnapInRead,Microsoft.PowerShell.Commands.AddPSSnapinCommand
-
Zack about 5 years@HarshaVardhini I am getting the same error but for PowerShell version 5. Did you figure out the problem?