Melbourne, Australia
To be provided
Use Contact to message

SCCM Documentation – Get SCCM Site Maintenance Tasks

Harmik Batth Tech's 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

SiteMaintenance

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

cls
$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
}
}
$SiteMaintenanceTaskWordTable

Desired Result will be like below

SiteMaintenance-Report.png

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

 

No Comments

Add your comment