According to the official Microsoft documentation, when upgrading to System Center Configuration Manager (current branch), it is recommended to disable any site maintenance tasks that could run during the upgrade (as they can cause the upgrade to fail), and to make a record of the task schedules for any disabled tasks:
Before you disable a task, record the schedule of the task so you can restore its configuration after the site upgrade completes.
Since I don’t want to manually note down the schedules for my maintenance tasks, I wrote a couple of PowerShell scripts to backup and restore the site maintenance task settings for me.
The backup script will export the settings for each site maintenance task and save them to file in json format.
The restore script will then read each backup file, compare the current settings in WMI with the backed-up settings for each maintenance task, and update anything that doesn’t match. The script will tell you if anything has changed and what the old and new values are.
If you run the backup before you disable the tasks, the restore script will re-enable them again.
Both scripts should be run elevated on your primary site server.
To backup, simply pass the sitecode and the backup directory to the script:
Backup-CMSiteMaintenanceTaskSettings -SiteCode ABC -BackupDirectory G:\Backup\SiteMaintenanceTasks
You will then see a json file for each site maintenance task in the backup directory:
To restore, pass the same parameters to the script:
Restore-CMSiteMaintenanceTaskSettings -SiteCode ABC -BackupDirectory G:\Backup\SiteMaintenanceTasks
The script will read each file then compare the settings with the current task settings in WMI. If there are any differences, these will be updated and reported: