With the introduction of Configuration Manager Current Branch (CB), the game of backup has changed slightly. A SQL backup is still valid for restoring the database, but re-installing ConfigMgr CB must be started by running setup.exe from the cd.latest folder. I know most of you are backing up the virtual machine (which is good), but that should not prevent you from not stop you from backing up SQL and Configmgr. You have two options:
- Create a SQL maintenance plan and include a custom step to backup cd.latest
- SQL backup Pros
- Support for compression
- Better scheduling job
- E-mail notifications
- No ConfigMgr service interrupted
- Include other databases in the backup job
- Run the ConfigMgr built-in maintenance task
- ConfigMgr Pros:
- Easy to configure
- You do not require any SQL experience
- Run custom scripts after backup is completed using the old afterbackup.bat method
- Include cd.latest and other ConfigMgr folders.
Personally I prefer the SQL method as I’m a big fan of compression and do not have time to copy 250 GB. Steve Thompson describes in this blog post how you can configure SQL backup for ConfigMgr 2012. My configuration is a long way exactly the same, except I will include a custom SQL Job. The SQL job will compress and copy .\Program files\Configuration Manager\cd.latest to the same location as my SQL backup files. The PowerShell job require, the SQL agent service to be running and the service account have permissions to the target path.
powershell.exe -command "Add-Type -Assembly ‘System.IO.Compression.FileSystem’ -PassThru | Select -First 1 | % { [IO.Compression.ZIPFile]::CreateFromDirectory(‘d:\program files\microsoft configuration manager\cd.latest’, ‘f:\sqlbck\archive’ + (Get-Date -format ‘yyyyMMddHHmm’) + ‘.zip’) }"
To create the job, follow these steps in SQL Management Studio:
- Open SQL Server Agent (ensure the SQL Agent service is running)
- Right click Jobs, create a New Job called Copy cd.latest and change the Owner to System (not required, but why not)
- Select the Steps page and click New. Configure the step with these values and click OK:
- Step name: copy cd.latest
- Type: Operating system (CmdExec)
- Run as: SQL Server Agent Service Account
- Command: Paste in the PowerShell command
- Click OK, to close the custom job.
In order to test the job, right click and select Start Job at Step.
Next step in the process is to configure a backup configmgr maintenance plan as described by Steve Thompson. I have followed the same steps, but will also include my custom copy cd.latest step in the plan.
- in SQL Management Studio, navigate to Management. Right click Maintenance Plans, and click Maintenance Plan Wizard.
- On the SQL Server Maintenance Plan Wizard page, click Next.
- Create a new plan with these settings:
- Name: SCCM Backup
- Run as: Select SQL Server Agent service account
- Select Single schedule for the entire plan or no schedule.
- Schedule: Click Change to configure a schedule
- Configure the schedule to match your backup criteria’s
- On the Select Maintenance Tasks page, select the following maintenance tasks:
Clean Up History
Back Up Database (Full)
Maintenance Cleanup Task
Execute SQL Server Agent Job - On the Select Maintenance Tasks Order page move Execute SQL Server Agent Job to the end and click Next.
- On the Define History Cleanup Task page, configure Remove historical data older than 1 week(s) (or what ever value you want) and click Next.
- On the Define Back Up Database (Full) Task page, in the General tab click All databases
- Still on the Define Back Up Database (Full) Task page, click the Destination tab and configure these settings and click Next:
Create a backup file for every database: enable Create a sub-directory for each database
Set backup-compression: Compress backup. - On the Define Maintenance Cleanup Task page, configure these settings and click Next:
Delete files of the following type: Backup files
Search folder and delete files based on an extension. In Folder, type you backup destination folder e.g. F:\SQLBCK, select Include first level subfolders and in File extension, type bak.
File age configure Delete files based on the age of the file at task run time and Delete files older than 1 week(s). - On the Define execute SQL Server Agent Job task page, select Copy cd.latest and click Next.
- Finish the wizard
Now is the time of truth, right click your maintenance plan and click Execute. Creating the zip file will take a few minutes, but once it’s done you have a complete backup set.
Huge thanks to my colleague Claus Codam for helping out with the PowerShell step.
Hello, Great post!
Can you explain how to configure this if you have a remote SQL server. So the Program filesConfiguration Managercd.latest isnt on the same server / drive / disk.
Thnx!
Hi Kent,
great script and tutorial. How about cleanup of the .zip-file? The regular SQL cleanup job won’t delete .zip-files older than X days, right?
Pascal
Hi Pascal,
Did you ever get an answer to this or do you need to update the powershell to remove the old copies of the cd.latest?
The CD.Latest folder is automatically copied by the SCCM Site Backup task in SCCM 1511.
Layout in destination backup path when using same UNC for SQL/SCCM:
CD.Latest
SiteDBServer
SiteServer
BackupDocument.xml
ConfigMgrBackup.ini
smsbkup.log
Does the SCCM Site Backup task work well for you in 1511 if backed up on UNC ?
I get problems with cd.latest folder
Error: Failed to backup \?GLOBALROOTDeviceHarddiskVolumeShadowCopy1PROGRAM FILESMICROSOFT CONFIGURATION MANAGERCD.LATEST up to \UNCBackupSCCMSMSBackupCD.Latest: ERROR: CTool::TreeCopy to \UNCBackupSCCMSMSBackupCD.Latest failed. Error = [error code: 5, error message: Access is denied.]. SMS_SITE_BACKUP 2016-02-05 08:29:38 1584 (0x0630)
All other folders work and get backed up
If I do it on local drive it works
Security does not differ from other drives
Hi
I had the same problem with the backup of CD.latest
i add an exeption on viruscan to resolve this issue
(Bloqué par une règle de protection de l’accès NT AUTHORITYSYSTEM SYSTEM:REMOTE G:SCCMBackupP03BackupCD.Latestautorun.inf Protection standard antivirus:Empêcher la création à distance de fichiers d’exécution automatique Action bloquée : Créer)
The following modification to the job will delete aging zip files in the backup directory. Some paths changed for my test environment.
powershell.exe -command “Get-ChildItem -Path ‘D:SCCM_Backup*’ -Include ‘*.zip’ | Where-Object {$_.CreationTime -lt (Get-Date).AddDays(-7)} | Remove-Item; Add-Type -Assembly ‘System.IO.Compression.FileSystem’ -PassThru | Select -First 1 | ForEach-Object { [IO.Compression.ZIPFile]::CreateFromDirectory(‘c:program filesmicrosoft configuration managercd.latest’, ‘D:SCCM_Backupcdlatest’ + (Get-Date -format ‘yyyyMMddHHmm’) + ‘.zip’) }”
Thank you for the hint Dan. Interesting though it works fine from command line, but being added to SQL job it does nothing (zipping still works).
Not sure I completely agree with the SQL only method for SCCM backup as it has always been considered a last chance method of restoration if you do not have a full Configuration Manager backup available. The CM backup has long been the preferred method of SCCM backup and I’m not sure Microsoft would say otherwise . Also, think of all of the existing log files and inboxes files that are coming in from client systems/in process/not yet committed to database and not included in a database only backup.
Andrew – Microsoft supports restore from a native SQL backup since CM 2012 Sp1. Disagree with last ditch, SQL backups are better for a lot of reasons. For more information please see: https://stevethompsonmvp.wordpress.com/2013/06/07/sql-server-backup-recommendations-for-configuration-manager/
[…] Configuring backup in ConfigMgr Current Branch […]
Since it is now necessary when restoring a site to install 1511, then 1606 (or whatever was current when something bad happened), is it still valuable to backup cd.latest? Is there a time when that would be helpful? I imagine there is, I just can’t think of it. -Thank you. Gary
P.S. Cleanup of older cd.latest zip files created in the powershell job can be accomplished with Maintenance Cleanup task attached to the backup Maintenance plan that calls the cd.latest backup. Just specify zip extension instead of bak.
Good day Guys,
I am used to design SCCM relaying on Active directory sites and services.
One of our new clients – are upgrading their network moving away from a point to point topology to an MPLS Cloud network setup.
Normally you would specify on the Domain controller the subnet mask of other sites that are close by – so that when the users authenticate – they authenticate on a local AD server and the same sites are discovered and used in SCCM.
Now with the MPLS, all packets go to the cloud first before they are redirected to the destination. Packets look for the shortest path.
What makes this even complicated is that in this setup is that – I am not sure whether do I still specify subnets in my AD sites and services – since a user logging on a local site -what happens is that first the log on request is sent to the MPLS Cloud.
Please advise me on where to place my domain and Secondary site or Distribution Point.
Also I was trying to avoid deploying the Central Administration Site on the same environment since there is no need for separate Primary Sites.
What is requested is High Availability and Site resilience on the 2 head office datacenters.
Thanks in advanced for this
Thanks
Definitᥱly imagine that which you stated. Your favourite justification appeared to be on the intᥱrnet thᥱ eаsiest factߋr to beaг
in mind of. I say to you, I definitely get annoyed at the same time as folks think about concerns that thᥱy pⅼainly dⲟn’t reсognise about.
You contrоllᥱd to hit the nail upon the highest as neatly as defined out the whole thing with no need side effect , people can take a signal.
Wiⅼl likely be bacк to get more. Thanks
my weblog keyword 2
[…] like me, you followed Kent Agurlund’s excellent guide on how to create SCCM backups using SQL you will have noticed that while it will only keep the last 7 backups, when you come to configure […]
[…] for SCCM CB recovery if you made at least one in-console upgrade for your SCCM. The article is here. Unfortunately his powershell script does not clean old cd.latest archives and that can be a […]
[…] Kent Agerlund [MVP] wrote a great article describing various ways to backup ConfigMgr. In his article he describes how to create a SQL Server Agent job that copies and compresses the cd.Latest folder. Run through the steps he outlines to create the job. https://blog.ctglobalservices.com/configuration-manager-sccm/kea/configuring-backup-in-configmgr-curr… […]
[…] most important part is the backup of your database. SCCM built-in task or an SQL backup is a debatable option. Some like the built-in one, other the SQL one, I like to recommend having […]