Skip to content

SPManagedPath

Yorick Kuijs edited this page Jun 13, 2018 · 18 revisions

SPManagedPath

Parameters

Parameter Attribute DataType Description Allowed Values
WebAppUrl Key string The URL of the web application to apply the managed path to - this is ignored for host header web applications
RelativeUrl Key string The relative URL of the managed path
Explicit Required boolean Should the host header be explicit? If false then it is a wildcard
HostHeader Required boolean Is this a host header web application?
Ensure Write string Present ensures managed path exists, absent ensures it is removed Present, Absent
InstallAccount Write PSCredential POWERSHELL 4 ONLY: The account to run this resource as, use PsDscRunAsCredential if using PowerShell 5

Description

Type: Distributed

This resource is responsible for creating managed paths associated with a specific web application. The WebAppUrl parameter is used to specify the web application to create the path against, and the RelativeUrl parameter lets you set the URL. Explicit when set to true will create an explicit inclusion path, if set to false the path is created as wildcard inclusion. If you are using host named site collections set HostHeader to true and the path will be created as a host header path to be applied for host named site collections.

The default value for the Ensure parameter is Present. When not specifying this parameter, the managed path is created.

Examples

Example 1

This example shows how to deploy an explicit managed path to a specifici web application

    Configuration Example 
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPManagedPath TestManagedPath 
            {
                WebAppUrl      = "http://sharepoint.contoso.com"
                InstallAccount = $SetupAccount
                RelativeUrl    = "example"
                Explicit       = $true
                HostHeader     = $false
            }
        }
    }

Example 2

This example shows how to add a wildcard managed path to a specific web application

    Configuration Example 
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPManagedPath TestManagedPath 
            {
                WebAppUrl      = "http://sharepoint.contoso.com"
                InstallAccount = $SetupAccount
                RelativeUrl    = "teams"
                Explicit       = $false
                HostHeader     = $true
            }
        }
    }

Example 3

This example shows how to remove a wildcard managed path from a specific web application

    Configuration Example 
    {
        param(
            [Parameter(Mandatory = $true)]
            [PSCredential]
            $SetupAccount
        )
        Import-DscResource -ModuleName SharePointDsc

        node localhost {
            SPManagedPath TestManagedPath 
            {
                WebAppUrl      = "http://sharepoint.contoso.com"
                InstallAccount = $SetupAccount
                RelativeUrl    = "teams"
                Explicit       = $false
                HostHeader     = $true
                Ensure         = "Absent"
            }
        }
    }
Clone this wiki locally