Skip to content

SPSiteUrl

dscbot edited this page Apr 14, 2025 · 10 revisions

Parameters

Parameter Attribute DataType Description Allowed Values
Url Key String The URL of the site collection
Custom Write String The URL of the Custom zone
Extranet Write String The URL of the Extranet zone
Internet Write String The URL of the Internet zone
Intranet Write String The URL of the Intranet zone

Description

Type: Distributed Requires CredSSP: No

This resource will configure the site url for a host named site collection. There are four available zones to configure: Intranet, Internet, Extranet and Custom.

It is not possible to change the site url for the Default zone, since this means changing the url that is used as identity. A site collection rename is required for that: $site = Get-SPSite "http://old.contoso.com" $new = "http://new.contoso.com" $site.Rename($new) ((Get-SPSite $new).contentdatabase).RefreshSitesInConfigurationDatabase

Examples

Example 1

This example configures the site collection urls for the specified Host Named Site Collection

Configuration Example
{
    param
    (
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $SetupAccount
    )

    Import-DscResource -ModuleName SharePointDsc

    node localhost
    {
        SPSiteUrl TeamSite
        {
            Url                  = "http://sharepoint.contoso.intra"
            Intranet             = "http://sharepoint.contoso.com"
            Internet             = "https://sharepoint.contoso.com"
            PsDscRunAsCredential = $SetupAccount
        }
    }
}
Clone this wiki locally