Problem
You receive below error executing PowerShell command/script while connecting to SharePoint site.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
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-SPWeb:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
⛏️ How to fix ?
The Site Url seems to be correct, so there is no problem with the script.⚡️ SharePoint Management Shell
You need to start PowerShell as "Run as administrator"
⚡️ Windows PowerShell Console
If you directly run this PowerShell command from Windows PowerShell Console, the PowerShell module is not auto imported in console. Execute below command and then load the script.Add-PSSnapin Microsoft.Sharepoint.Powershell
$spWeb = Get-SPWeb "[SharePoint Site link]"
⚡️ Windows PowerShell ISE
Execute below command and then load the script.Add-PSSnapin Microsoft.Sharepoint.Powershell
$spWeb = Get-SPWeb "[SharePoint Site link]"
⚡️ SharePoint Online Management Shell
Get-SPWeb cmdlet is applicable only for SharePoint on-premise and will not work for SharePoint Online.Refer PowerShell SharePoint Online commands or PnP PowerShell commands for working with SPO.
Get-SPOSite -Identity [SharePoint Online Site link]
Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!