SCCM Documentation – Get SCCM Site Maintenance Tasks

Lets get Site Maintenance Tasks for SCCM Server in current environment.

What are we achieving here, is to display and report what is configured for Site Maintenance tasks- example below


So to get the desired result, we will run the following powershell commands

$CMSites = Get-CMSite

ForEach($CMSite in $CMSites)
$SiteMaintenanceTaskWordTable = @()
$SiteMaintenanceTasks = Get-CMSiteMaintenanceTask -SiteCode $CMSite.SiteCode
Write-Output “Site Maintenance Tasks for Site $($CMSite.SiteCode)”

ForEach($SiteMaintenanceTask in $SiteMaintenanceTasks)
$TempObj = New-Object -TypeName PSObject
Add-Member -InputObject $TempObj -MemberType ‘NoteProperty’ -Name ‘Task’ -Value $SiteMaintenanceTask.TaskName
Add-Member -InputObject $TempObj -MemberType ‘NoteProperty’ -Name ‘Enabled’ -Value $SiteMaintenanceTask.Enabled
$SiteMaintenanceTaskWordTable  += $TempObj

Desired Result will be like below


That’s it, we have now collected all Site Maintenance Tasks for current Site.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s