How to verify if site maintenance tasks are running successfully

If you would like to know if the site maintenance tasks are running successfully you can either check the site status for errors or use the below SQL query

select *,
floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/3600) as Hours,
floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/60)- floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/3600)*60 as Minutes,
floor(DATEDIFF(ss,laststarttime,lastcompletiontime))- floor(DATEDIFF(ss,laststarttime,lastcompletiontime)/60)*60 as TotalSeconds
from SQLTaskStatus

Completion status – 0 = Success

SMT

Powershell script to compare DP packages with WMI

http://blogs.technet.com/b/configmgrteam/archive/2012/05/07/troubleshooting-content-mismatch-warnings-on-a-distribution-point-in-system-center-2012-configuration-manager.aspx

Blog on the content library

Blog on troubleshooting content 2012

$WMIPkgList = Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib | Select -ExpandProperty PackageID | Sort-Object

$ContentLib = (Get-ItemProperty -path HKLM:SOFTWARE\Microsoft\SMS\DP -Name ContentLibraryPath)

$PkgLibPath = ($ContentLib.ContentLibraryPath) + “\PkgLib”

$PkgLibList = (Get-ChildItem $PkgLibPath | Select -ExpandProperty Name | Sort-Object)

$PkgLibList = ($PKgLibList | ForEach-Object {$_.replace(“.INI”,””)})

$PksinWMIButNotContentLib = Compare-Object -ReferenceObject $WMIPkgList -DifferenceObject $PKgLibList -PassThru | Where-Object { $_.SideIndicator -eq “” }

Write-Host Items in WMI but not the Content Library
Write-Host ========================================
$PksinWMIButNotContentLib

Write-Host Items in Content Library but not WMI
Write-Host ====================================
$PksinContentLibButNotWMI

To remove the item from WMI (Using the list from the previous script):
Foreach ($Pkg in $PksinWMIButNotContentLib){
Get-WmiObject -Namespace Root\SCCMDP -Class SMS_PackagesInContLib -Filter “PackageID = ‘$Pkg'” | Remove-WmiObject -Confirm
}

To remove INI files using the list from the previous script:
Foreach ($Pkg in $PksinContentLibButNotWMI){
Remove-Item -Path “$PkgLibPath\$Pkg.INI” -Confirm
}

Use the Configuration Analyzer to troubleshoot System Center components

It’s no secret that the many tools in System Center 2012, and the new features in Service Pack 1 (SP1) to System Center 2012, present a vast array of architecture and configuration decisions. While all the components work together to deliver data center management and cloud services, each formerly-separate product like Operations Manager (SCOM) or Configuration Manager (SCCM), does requires its own configuration. Missteps, oversights, or just typos in setting up System Center 2012 SP1 can vex admins when components don’t work or interoperate as needed-and each component needs to be set up “just so” to achieve their collective potential.

Microsoft has released a way to discover how to optimally configure System Center 2012 SP1 components: The System Center 2012 SP1 Configuration Analyzer is your new first-line troubleshooting tool for issues with System Center 2012 SP1 server-side components. Keeping true to the theme that System Center 2012 SP1 is one product with various components, Microsoft released this single analyzer for the entire System Center 2012 SP1 suite, rather than individual tools for each component. The business benefit is that you can make sure you are getting the most value from your management software with little additional effort and at no cost.

A best practice analyzer for your management tools