PowerShell for SharePoint (on-prem)

Create Managed Paths in SharePoint Server using PowerShell

Managed paths in SharePoint Server are a way to differentiate your Site Collections with a chosen URL, and are created at the Web Application level.
Those can be created via the SharePoint Central Admin (CA), but this blog post will focus on using PowerShell.

You can create 2 types of managed paths:

  • Explicit (create a single site collection with the specified address)
  • Wildcard (ability to create multiple site collections to the path that you specify)

 

IMPORTANT: This post doesn’t apply to SharePoint Online as only /sites/ and /teams/ are available (at the time of writing: Dec. 2017)

 

Minimum requirements:

  • Web Application
  • Permissions to run PowerShell cmdlets
  • Permissions to log into SharePoint Central Admin (for verification purposes)

 

Current Managed Paths in the environment

At this point in time, there’s only the default managed path under my “Portal” Web Application.

currentMP_Portal_img
Current environment

 

Create an Explicit managed path

Let’s open PowerShell ISE (use SharePoint Management Shell if you prefer), and start defining the variables we need when using the New-SPManagedPath cmdlet.

We are going to create each type as follow:

  • /hr (Explicit for the Human Resources department)
  • /projects (Wildcard for teams working on projects)
declareVariables
Declare variable in PowerShell ISE

Run the script for the variables to be in memory… And let’s create the explicit managed path

New-ManagedPath_HR

Don’t forget to add the -Explicit switch in the command, otherwise it will create a Wildcard managed path!

 

Create an Wildcard managed path

Run the same cmdlet with the variable $ManagedPathProjects, and removing the -Explicit switch

New-ManagedPath_Projects

 

Verification

Via SharePoint Central Admin

verif_CA

 

Via PowerShell

verif_PS

 

 

Loading Likes... Tagged , , ,