Skip to content

SPSiteUrl

dscbot edited this page Mar 17, 2023 · 9 revisions

SPSiteUrl

Parameters

Parameter Attribute DataType Description Allowed Values
Url Key String The URL of the site collection
Intranet Write String The URL of the Intranet zone
Internet Write String The URL of the Internet zone
Extranet Write String The URL of the Extranet zone
Custom Write String The URL of the Custom 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