0

I am trying to create a site collection using powershell script but keep getting error even though I already created Managed Path I am referencing in cmdlet,

PS C:\Users\svc_spadmin> New-SPManagedPath "Teams" -WebApplication "http://share
point2010/"

Name                           Type
----                           ----
teams                          WildcardInclusion


PS C:\Users\svc_spadmin> New-SPSite -URL "http://sharepoint2010/teams" -ownerAli
as "sp\svc_spadmin" -Template "STS#0"

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. At line:1 char:11 + New-SPSite <<<< -URL "http://sharepoint2010/Teams" -ownerAlias "sp\svc_spadm in" -Template "STS#0" + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletNewSite: SPCmdletNewSite) [New-SPSite], SPCmdletException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite

Edit

PS C:\Users\svc_spadmin> New-SpManagedPath -RelativeURL "MPOne" -WebApplication
"http://sharepoint2010/"

Name                           Type
----                           ----
mpone                          WildcardInclusion



PS C:\Users\svc_spadmin> New-SPSite -URL "http://sharepoint2010/mpone/testsite"
-ownerAli "sp\svc_spadmin" -Template "STS#0"

New-SPSite : The URL '/mpone/testsite' is invalid. It may refer to a nonexiste nt file or folder, or refer to a valid file or folder that is not in the curren t Web. At line:1 char:11 + New-SPSite <<<< -URL "http://sharepoint2010/mpone/testsite" -ownerAli "sp\sv c_spadmin" -Template "STS#0" + CategoryInfo : InvalidData: (Microsoft.Share...SPCmdletNewSite: SPCmdletNewSite) [New-SPSite], SPException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletNewSite

1 Answer 1

1

You have created a managed path named teams, now you actually need to create a site collection under this managed path. So you should name the site collection url something like "http://sharepoint2010/teams/testsite.Follwoing should be the PS command:

New-SPSite -URL "http://sharepoint2010/teams/testsite" -ownerAli
as "sp\svc_spadmin" -Template "STS#0"

Moreover, the correct way of creating the managed path is

New-SPManagedPath –RelativeURL "Teams" -WebApplication "http://share
point2010/"

The above script will create wild card inclusion, If you want explicit inclusion just add
-Explicit

3
  • Thanks, I tried it before and again now but it didn't worked Jan 23, 2013 at 11:15
  • I just checked it on my VM and a site collection is created successfully. Can you see the managed path being created in the UI. Can you try creating a new webapplication and see if the script works there. Jan 23, 2013 at 11:28
  • It worked on new web application but I am still confused why it didn't worked on default one created by SharePoint while farm wizard tho Jan 23, 2013 at 11:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.