Managed paths in SharePoint enables us to create a uniform navigational structure to group multiple site collections together. SharePoint Managed Paths can be defined using PowerShell or STSADM command-line tool. Managed paths are explained in my other article: Managed path in SharePoint
Create Managed Path in SharePoint using PowerShell:
Use New-SPManagedPath cmdlet to create a new managed path in a web application on the SharePoint farm.
New-SPManagedPath -WebApplication "https://sharepoint.company.com" -RelativeURL "teams"
This adds a managed path in SharePoint 2013 using PowerShell. By default, the managed path is created as a wildcard inclusion type. You can include the Explicit switch to create a managed path of explicit inclusion type.
New-SPManagedPath -WebApplication "https://sharepoint.company.com" -RelativeURL "/departments/" -Explicit
PowerShell to Delete Managed path in SharePoint:
If you need to delete a managed path from a specific web application: use Remove-SPManagedPath cmdlet.
Remove-SPManagedPath -Identity "Teams" -WebApplication "https://sharepoint.company.com"
Technet Reference for configuring managed paths: https://docs.microsoft.com/en-us/sharepoint/administration/define-managed-paths
Check whether a Particular Managed Path Exists:
PowerShell offers one more cmdlet: Get-SPManagedPath to check the existence of a managed path. Say, for e.g. you may want to check whether a particular managed path exists or not before creating a managed path.
Get Existing Managed Paths
Get-SPManagedPath -WebApplication "https://sharepoint.company.com"
Get-SPManagedPath displays all managed paths for the given web application. Let’s check if the managed path exists before creating a new managed path:
Create a managed path in SharePoint using PowerShell
Let’s add a managed path in SharePoint 2013 with PowerShell
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
write-host "Enter the Web Application URL:"
write-host "Enter the Managed Path:"
#Check whether the particular managed path exist already
$ManagedPathExists = Get-SPManagedPath -WebApplication $WebAppURL -Identity $ManagedPath -ErrorAction SilentlyContinue
if ($ManagedPathExists -eq $null)
#Go ahead and create the managed path
New-SPManagedPath -RelativeURL $ManagedPath -WebApplication $WebAppURL
Write-Host "Managed path $ManagedPath already exists!"
Using STSADM Tool to Add/Remove Managed Path:
These two stsadm command line tool switches available to Add/Remove Managed paths in SharePoint.
- Stsadm -o AddPath
- Stsadm -o DeletePath
stsadm -o addpath -url <managed path URL followed by web app URL> -type <explicitinclusion or wildcardinclusion>
stsadm -o addpath -url https://sharepoint.company.com/teams/ -type wildcardinclusion
Delete managed path in SharePoint using STSADM:
stsadm -o deletepath -url <Managed Path URL with Web App>
stsadm -o deletepath -url https://sharepoint.company.com/teams/
Tail: What if I delete the Managed path in use?
Answer: Your SharePoint Sites under the specific managed path will result: HTTP 404 Page Not Found! Refer my post: SharePoint Managed Paths – FAQs – If you have any questions on SharePoint Managed paths!