Search code examples
sharepoint-2010

Can't create a site collection through SharePoint Managment Shell for SharePoint 2010


I tried to run the same commands as in here -https://technet.microsoft.com/en-us/library/cc263165(v=office.14).aspx .

 $template = Get-SPWebTemplate "STS#0"
New-SPSite -Url "http://web-application-name/sitecollection1" -OwnerAlias "domain\administrator" -Template $template

I am getting the following error: New-SPSite : A site collection could not be created as the provided managed pat h does not exist. Change the URL to use an existing managed path or create the missing managed path prior to calling this command.

What does this error mean? What am i missing?


Solution

  • 1.$template = Get-SPWebTemplate "STS#0"

    if you are getting error upon running this command use this link https://support.microsoft.com/en-us/help/2796733/sharepoint-2010-management-shell-does-not-load-with-windows-powershell-3.0 to fix it

    2.Create a managed path

    New-SPManagedPath -RelativeURL "sitecollection1" -WebApplic ation "web-application-name"

    3.Create the site collection

    New-SPSite -URL "http://web-application-name/sites/sitecollection1"-OwnerAlias "domain\administrator" -Template $template

    It is not very clear for my how to create a site collection with a path like: http://web-application-name/sitecollection2 But this solution worked for what i needed.