Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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

share|improve this answer
    
Thanks, I tried it before and again now but it didn't worked –  Muhammad Raja Jan 23 '13 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. –  Nadeem Yousuf Jan 23 '13 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 –  Muhammad Raja Jan 23 '13 at 11:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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