Computer tape storage robot.

IIS backup and restore

Learn how to back up and restore IIS 10 webserver configuration with appcmd.exe and PowerShell

Home » Windows Server » IIS backup and restore

If you are using Windows Server IIS as your web server software, it is important to make regular backups. Luckily, using appcmd or PowerShell, this is quite easy.

This post shows you how to back up and restore IIS 10 webserver configuration with appcmd.exe and PowerShell.

Creating backups ensures you have valid data to restore when something went wrong. For example, if you deleted a site that shouldn’t be deleted, you can restore the created IIS backup. It particularly comes in handy when you remove orphaned IIS web applications automatic in a PS script.

Did you know IIS automatically creates these backups when you change settings through IIS Manager? You can find them in %SystemDrive%\inetpub\history. This is part of the built-in IIS configuration history feature. Neat, right?! 🙂

Using appcmd list backup you can view the available IIS configuration history feature:

PS C:\inetpub\history> appcmd list backup
BACKUP "CFGHISTORY_0000000104"
BACKUP "CFGHISTORY_0000000105"
BACKUP "CFGHISTORY_0000000106"
BACKUP "CFGHISTORY_0000000107"
BACKUP "CFGHISTORY_0000000108"
BACKUP "CFGHISTORY_0000000109"
BACKUP "CFGHISTORY_0000000110"
BACKUP "CFGHISTORY_0000000111"
BACKUP "CFGHISTORY_0000000112"
BACKUP "CFGHISTORY_0000000113"
BACKUP "CFGHISTORY_0000000114"

I can create an IIS backup using the add parameter:

PS C:\inetpub\history> appcmd add backup
BACKUP object "20191105T002034" added

and list lists it

PS C:\inetpub\history> appcmd list backup
BACKUP "20191105T002034"
BACKUP "CFGHISTORY_0000000104"
[...]

The backups created by appcmd are saved in the directory C:\Windows\System32\inetsrv\backup\.

If needed, you can restore a backup easily in IIS with appcmd.exe as well:

PS C:\inetpub\history> appcmd restore backup /backup.name:"20191105T002034" /stop:true
Restored configuration from backup "20191105T002034"

The command above restores the backup called “20191105T002034”, and by using /stop:true I forced IIS to stop before performing the restore.

See also  Remove IIS Server version HTTP Response Header

Backup and restore IIS configuration with Powershell

If you want to use PowerShell to create an IIS configuration backup, you can use the Backup-WebConfiguration cmdlet. Backup-WebConfiguration is available in the webadministration module.

The Conditionally start Application Pools on remote IIS web servers post has more information about the PowerShell webadministration module.

An easy to use example is:

PS C:\Users\janreilink> Backup-WebConfiguration -Name MyIISBackup

Name                                 Creation Date
---- -------------
MyIISBackup                          12/19/2019 12:00:00 AM

Backups are stored in the C:\Windows\System32\inetsrv\backup directory.

Summary

  • Regular backups are essential for Windows Server IIS to restore configurations easily when issues arise.
  • This article explains how to back up and restore IIS configuration using appcmd.exe and PowerShell.
  • IIS automatically creates backups in %SystemDrive%\inetpub\history when settings change in IIS Manager.
  • You can view and create backups with appcmd commands, stored in C:\Windows\System32\inetsrv\backup.
  • PowerShell’s Backup-WebConfiguration cmdlet offers an alternative for creating backups in the same directory.

HTH 🙂

0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
trackback
How to remove IIS from Windows Server using PowerShell - Sysadmins of the North
2025-07-02 3:17 pm

[…] removing IIS from your server, don’t forget to backup IIS and its […]

trackback
Install IIS in Windows 11 using PowerShell - Sysadmins of the North
2025-11-01 9:02 am

[…] you ever need to remove IIS you can use PowerShell as well. Obviously, don’t forget to back up IIS first, and then remove IIS from […]