Configuration Backup and Restore
One wrong click in IIS Manager can break every site. A configuration backup restores everything in seconds.
On this page · 5 min · Advanced
On this page
- Learning objectives
- Explanation
- Step-by-step screens
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Advanced
- Updated
- Nov 26, 2026
Related tutorials
Interview questions
Learning objectives#
- Know where IIS stores its configuration
- Use the automatic configuration history
- Create and restore named backups
- Copy configuration to a new server
Explanation#
Server-level configuration lives in %windir%\system32\inetsrv\config (applicationHost.config, administration.config, redirection.config). Site settings may also live in each site’s web.config, which belongs with the site’s files.
IIS keeps an automatic history: every 2 minutes, if the configuration changed, a copy goes to %SystemDrive%\inetpub\history\CFGHISTORY_xxxxxxxx (10 copies by default).
Before any big change, take a named backup: appcmd add backup "before-ssl-change". appcmd list backup shows them; appcmd restore backup "name" puts one back (IIS restarts its services).
To move to a new server, Web Deploy (msdeploy -verb:sync -source:webServer) copies configuration and content; or export with Shared Configuration’s Export and import carefully — machine keys and certificates must move too.
Step-by-step screens#
Drawings of IIS Manager in IIS 10 (Windows Server 2019/2022, Windows 10/11). The red numbers match the numbered actions under each picture; names on your computer will differ.
Loading pictures…
Code example: Named backup, change, restore#
$appcmd = "$env:windir\system32\inetsrv\appcmd.exe"
& $appcmd add backup "before-ssl-change"
& $appcmd list backup
# ...a change goes wrong...
& $appcmd restore backup "before-ssl-change"
# PowerShell equivalent
Import-Module WebAdministration
Backup-WebConfiguration -Name 'nightly-2026-11-26'
Get-WebConfigurationBackup | Select-Object Name, CreationDate
BACKUP object "before-ssl-change" added BACKUP "CFGHISTORY_0000000012" BACKUP "before-ssl-change" Restored configuration from backup "before-ssl-change"
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- add backup copies the config folder under inetsrv\backup\before-ssl-change.
- list backup shows named and automatic history backups.
- restore backup puts the files back and restarts IIS services.
- Backup-WebConfiguration does the same from PowerShell.
Real-world use case#
An admin removed the wrong binding during a certificate change and three sites went down. appcmd restore backup "before-ssl-change" brought them back in 15 seconds.
Common mistakes#
It keeps 10 copies; a busy day of changes pushes the good one out. Take named backups before risky work.
Encrypted passwords use machine keys; a config restored elsewhere can fail to decrypt. Use Web Deploy or Shared Configuration export.
Best practices#
- Named backup before every change
- Include config folder in server backups
- Keep web.config in source control
- Document certificates and machine keys
Remember this#
Config: inetsrv\config.
History: inetpub\history.
appcmd add/list/restore backup.
Practice exercise#
Your task: Create a named IIS configuration backup called pre-upgrade.
Show solution
& "$env:windir\system32\inetsrv\appcmd.exe" add backup "pre-upgrade"
Mini quiz#
Where does IIS keep its automatic configuration history?
Want more? Practise all IIS MCQs · IIS interview questions
My notes#
Saved in this browser.