Using PowerShell to create wildcard Managed Paths in SharePoint 2010

Home > Blogs > PowerShell > Using PowerShell to create wildcard Managed Paths in SharePoint 2010

Using PowerShell to create wildcard Managed Paths in SharePoint 2010

Like This Blog 1 Spike Xavier
Added by May 13, 2013

Managed Paths allow us to extend Web Applications to hundreds of thousands of site collections without having to bother the I.T. Administration staff with a bunch of DNS entry requests. It's easy enough to go into Central Administration as a member of the Farm Administrators Group and go to Manage Web Applications and add a new Managed Path. But it's even easier to do via the SharePoint Management Shell!

Here are the steps in this blog:

1. Run Get-SPManagedPath and pass in the web application I want to add the managed path to in order to make sure it's not already there.

2. Run New-SPManagedPath and pass in the web application I want to add the new managed path to.

3. Provide the text for the managed path when prompted for the parameter (in this case "blogs") no quotes are neccessary for a word.

4. Validate the results which will print to the console when the commandlet has successfully completed.

5. Run Get-SPManagedPath and pass the web application (repeat of step 1, try using the up arrow or F7, it's easier) and notice that the blogs wild card managed path has now been added as a Wildcard Managed Path.

6. Using the Managed Path – now that I've got this managed path, might as well use it, I run a New-SPSite commandlet and create a new team site at http://sp360.local/blogs/dw .

7. Create the default associated SharePoint Security Groups (Thanks Lester From Neudesic).

8. Go to the new team site and start working!

One thing to keep in mind is that all of this happened without any new DNS entries. SharePoint managed the whole thing. There is a limit of 20 Managed Paths per Web Application so these aren't something to knock out time after time, but hey this is my dev environment and this thing will most likely be gone by the time you read this blog. There is a difference between Explicit and Wildcard managed paths. Simply put:

Explicit managed path – you type in the url including the managed path and you get the home page of the top level site of a site collection.
i.e. http://sp360.local/ – in this case the / is the explicit managed path (referred to as the root) but I could have created an explicit managed path "portal" and if I did and typed in http://sp360.local/portal I would get the home page of the top level site of the site collection I created at that url.

Wild Card Managed Paths – these can be thought of as placeholders after which you can place site collections. In the case of this blog post I created a wildcard managed path blogs and it was created as a wildcard managed path, so if I type in http://sp360.local/blogs I will get page not found. (The only time I'm happy to see this as a web developer 🙂 ) However I am free to create about 249,998 site collections and have them start after. The site collection I created in this blog is located at http://sp360.local/blogs/dw so the only thing I really did was say, put this site collection at dw which will come after http://sp360.local/blogs/

I run Get-SPManagedPath

I-run-Get-SPManagedPath.png

I run Get-SPManagedPath and pass in the web application I want to add the managed path to in order to make sure it's not already there.

Run new SPManagedPath

Run-New-SPManagedPath.png

Next I Run New-SPManagedPath and pass in the web application I want to add the new managed path to.

Provide the text for the Managed Path

Provide-The-Text-For-The-Managed-Path.png

Now I provide the text for the managed path when prompted for the parameter (in this case "blogs") no quotes are neccessary for a word.

Validate results in shell window

Validate-Results-In-Shell-Window.png

I validate the results which will print to the console when the commandlet has successfully completed.

Run Get-SPMangedPath again

Run-Get-SPMangedPath-Again.png

Now it's time to once again Run Get-SPManagedPath and pass the web application (repeat of step 1, try using the up arrow or F7, it's easier) and notice that the blogs wild card managed path has now been added as a Wildcard Managed Path.

Use the new Managed Path

Use-the-new-Managed-Path.png

I made it, now I'm going to use it. Using the Managed Path – now that I've got this managed path, might as well use it, I run a New-SPSite commandlet and create a new team site at http://sp360.local/blogs/dw .

Create Default Associated Groups

Create-Default-Associated-Groups.png

When you use the New-SPSite to create a new site collection using the Team Site Template (STS#0) you don't get the default associated SharePoint security groups so I always run the CreateDefaultAssociatedGroups on the rootweb (learned this from Lester Sconyers) So in this step I Create the default associated SharePoint Security Groups (Thanks Lester From Neudesic).

Experience the magic

Experience-The-Magic.png

That's it. All done. Thought it, Created It, Using It. PowerShell and SharePoint are quite a pair. Seriously , PowerShell is punk.

Spike Xavier
SharePoint Instructor – Interface Technical Training
Phoenix, AZ

Videos You May Like

Creating Users and Managing Passwords in Microsoft Office 365

0 745 4

In this Office 365 training video, instructor Spike Xavier demonstrates how to create users and manage passwords in Office 365.   For instructor-led Office 365 training classes, see our course schedulle: Spike Xavier SharePoint Instructor – Interface Technical Training Phoenix, AZ 20347: Enabling and Managing Office 365    

Using Navigation Controls in a Collaboration Site in SharePoint

0 350 1

In this SharePoint training video, I want to talk about the Navigation Controls in SharePoint. They tend to fall into two kind of different categories; one with the navigation controls in a typical Collaboration Site such as a Team Site or a Project Site. These are Sites that are based on the Team Site Template … Continue reading Using Navigation Controls in a Collaboration Site in SharePoint

How to Use SharePoint Navigation Controls in a Publishing Site

0 233 2

For more SharePoint training videos in this series, see: Part 1 – Using Navigation Controls in a Collaboration Site in SharePoint Part 2 – » Using Navigation Controls in a Publishing Site in SharePoint « Part 3 – Configuring SharePoint Navigation in a Publishing Site – Activating the Publishing Feature Part 4 – How to Configure Navigation in SharePoint … Continue reading How to Use SharePoint Navigation Controls in a Publishing Site

Write a Comment

See what people are saying...

    Share your thoughts...

    Please fill out the comment form below to post a reply.