Canberra, Australia
To be provided
To be provided

SCCM Documentation – Get SCCM Site Maintenance Tasks

Harmik Batth Tech Blog

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.


No Comments

Add your comment