Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Powershell Error "The term 'Get-SPWeb' is not recognized as the name of a cmdlet, function..."

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?

like image 843
LifeScript Avatar asked Jun 20 '12 15:06

LifeScript


People also ask

What is get SPWeb?

The Get-SPWeb cmdlet returns all subsites that match the scope given by the Identity parameter. All subsites that meet the criteria are returned. The Identity can be either the full URL or a relative path.

How do I install SharePoint PowerShell modules?

To get started using PowerShell to manage SharePoint Online, you need to install the SharePoint Online Management Shell and connect to SharePoint Online. Install the SharePoint Online Management Shell by downloading and running the SharePoint Online Management Shell or installing the module from the PowerShell Gallery.


2 Answers

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.

like image 95
nimizen Avatar answered Sep 28 '22 08:09

nimizen


Run this script from SharePoint 2010 Management Shell as Administrator.

like image 39
garec Avatar answered Sep 28 '22 08:09

garec