Set-CMSiteMaintenanceTask

Change settings for a Configuration Manager maintenance task.

Syntax

Set-CMSiteMaintenanceTask
   [-FixedRun]
   [-RunIntervalMins <Int32>]
   [-RunNow]
   -SummaryTask <SummaryTask>
   [-PassThru]
   [-SiteCode <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMSiteMaintenanceTask
   [-BeginTime <DateTime>]
   [-DaysOfWeek <DaysOfWeek[]>]
   [-DeleteOlderThanDays <Int32>]
   [-DeviceName <String>]
   [-EnableAlert <Boolean>]
   [-Enabled <Boolean>]
   -InputObject <IResultObject>
   [-LatestBeginTime <DateTime>]
   [-SiteBackupPath <String>]
   [-SqlBackupPath <String>]
   [-PassThru]
   [-SiteCode <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMSiteMaintenanceTask
   [-BeginTime <DateTime>]
   [-DaysOfWeek <DaysOfWeek[]>]
   [-DeleteOlderThanDays <Int32>]
   [-DeviceName <String>]
   [-EnableAlert <Boolean>]
   [-Enabled <Boolean>]
   [-LatestBeginTime <DateTime>]
   -Name <String>
   [-SiteBackupPath <String>]
   [-SqlBackupPath <String>]
   [-PassThru]
   [-SiteCode <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-CMSiteMaintenanceTask
   [-BeginTime <DateTime>]
   [-DaysOfWeek <DaysOfWeek[]>]
   [-DeleteOlderThanDays <Int32>]
   [-DeviceName <String>]
   [-EnableAlert <Boolean>]
   [-Enabled <Boolean>]
   [-LatestBeginTime <DateTime>]
   -MaintenanceTask <MaintenanceTask>
   [-SiteBackupPath <String>]
   [-SqlBackupPath <String>]
   [-PassThru]
   [-SiteCode <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-CMSiteMaintenanceTask cmdlet changes settings for a Configuration Manager maintenance task. For more information, see Maintenance tasks.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Set a maintenance task to run once a week

This example specifies that the maintenance task named Backup SMS Site Server runs on Friday each week on the Configuration Manager site that has the site code CM1.

Set-CMSiteMaintenanceTask -SiteCode "CM1" -MaintenanceTaskName "Backup SMS Site Server" -DaysOfWeek Friday

Example 2: Configure backup destinations

Set-CMSiteMaintenanceTask -Name $TaskName -SiteBackupPath "c:\site-backup" -SqlBackupPath "c:\sql-backup" -BeginTime (Get-Date) -DaysOfWeek Sunday,Monday -EnableAlert $true -Enabled $true

Parameters

-BeginTime

Specify the date and time at which a maintenance task starts.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DaysOfWeek

Specify an array of day names that determine the days of each week on which the maintenance task runs.

Type:DaysOfWeek[]
Accepted values:Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeleteOlderThanDays

For maintenance tasks that delete aged data, use this parameter to specify the number of days.

Type:Int32
Aliases:DeleteOlderThan, DeleteThanOlderDays
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeviceName

Specifies the name of the device on which the maintenance task runs.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-EnableAlert

Set this parameter to $true to enable alerts for task failures, if the task supports it.

Type:Boolean
Aliases:EnabledAlert
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

Indicates whether the maintenance task is enabled in Configuration Manager.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FixedRun

Indicates that this cmdlet modifies the maintenance task as a fixed run.

Type:SwitchParameter
Aliases:FixedRunInterval, DisableFixedRunInterval
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-InputObject

Specify the maintenance task object to configure. To get this object, use the Get-CMSiteMaintenanceTask cmdlet.

Type:IResultObject
Aliases:MaintenanceTaskObject
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-LatestBeginTime

Specifies a future date and time at which the maintenance task runs.

Type:DateTime
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MaintenanceTask

Specify the name of a maintenance task to configure.

Type:MaintenanceTask
Accepted values:BackupSiteServer, CheckApplicationTitleWithInventoryInformation, ClearUndiscoveredClients, DeleteAgedApplicationRequestData, DeleteUnusedApplicationRevisions, DeleteAgedClientOperations, DeleteAgedCollectedFiles, DeleteAgedComputerAssociationData, DeleteAgedDeleteDetectionData, DeleteAgedDeviceWipeRecord, DeleteAgedDiscoveryData, DeleteAgedEnrolledDevices, DeleteAgedEndpointProtectionHealthStatusHistoryData, DeleteAgedDevicesManagedByTheExchangeServerConnector, DeleteAgedInventoryHistory, DeleteAgedLogData, DeleteAgedSoftwareMeteringData, DeleteAgedSoftwareMeteringSummaryData, DeleteAgedClientPresenceHistory, DeleteAgedNotificationTaskHistory, DeleteAgedReplicationTrackingData, DeleteAgedReplicationSummaryData, DeleteAgedStatusMessages, DeleteAgedThreatData, DeleteAgedUnknownComputers, DeleteAgedUserDeviceAffinityData, DeleteInactiveClientDiscoveryData, DeleteObsoleteAlerts, DeleteObsoleteClientDiscoveryData, DeleteObsoleteForestDiscoverySitesAndSubnets, EvaluateProvisionedAmtComputerCertificates, MonitorKeys, RebuildIndexes, SummarizeSoftwareMeteringFileUsageData, SummarizeInstalledSoftwareData, SummarizeSoftwareMeteringMonthlyUsageData, DeleteAgedDistributionPointUsageStats, DeleteAgedProxyTrafficData
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specify the name of a maintenance task object to configure.

Type:String
Aliases:MaintenanceTaskName, TaskName, ItemName
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:True

-PassThru

Returns an object representing the item with which you're working. By default, this cmdlet may not generate any output.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunIntervalMins

Type:Int32
Aliases:RunIntervalMinutes
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RunNow

Add this parameter to have Configuration Manager run the maintenance task immediately.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SiteBackupPath

Applies to version 2010 and later. For the Backup Site Server task, specify the Site backup destination. The site server computer account needs full control to the destination folder.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SiteCode

Specifies the site code of the Configuration Manager site that hosts the site system role.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SqlBackupPath

Applies to version 2010 and later. For the Backup Site Server task, specify the SQL backup destination. The site server computer account needs full control to the destination folder.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-SummaryTask

Specifies a summary maintenance task.

Type:SummaryTask
Accepted values:UpdateApplicationCatalogTables
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

IResultObject