Skip to content

SPWebAppSiteUseAndDeletion

dscbot edited this page Mar 17, 2023 · 18 revisions

SPWebAppSiteUseAndDeletion

Parameters

Parameter Attribute DataType Description Allowed Values
WebAppUrl Key String The URL of the web application
SendUnusedSiteCollectionNotifications Write Boolean Should emails be sent to notify site owners of unused site collections
UnusedSiteNotificationPeriod Write UInt32 How many days should pass before a site is flagged as unused
AutomaticallyDeleteUnusedSiteCollections Write Boolean Should unused site collection be automatically deleted
UnusedSiteNotificationsBeforeDeletion Write UInt32 How many days before an unused site is deleted should an email be sent to the owner

Description

Type: Distributed Requires CredSSP: No

This resource is responsible for controlling the Site Use and Deletion settings on a specific web application. You can enable or disable the Site Use and Deletion feature, specify the amount of days after which the alerts are being send, if sites have to be deleted automatically and if so after how many

Examples

Example 1

This example shows how to apply site use and deletion settings to the specified web application

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

    Import-DscResource -ModuleName SharePointDsc

    node localhost
    {
        SPWebAppSiteUseAndDeletion ConfigureSiteUseAndDeletion
        {
            WebAppUrl                                = "http://example.contoso.local"
            SendUnusedSiteCollectionNotifications    = $true
            UnusedSiteNotificationPeriod             = 90
            AutomaticallyDeleteUnusedSiteCollections = $true
            UnusedSiteNotificationsBeforeDeletion    = 24
            PsDscRunAsCredential                     = $SetupAccount
        }
    }
}
Clone this wiki locally