Warm tip: This article is reproduced from serverfault.com, please click

Schedule IIS configuration Back up

发布于 2021-03-15 05:43:03

I need a solution to fully backup my IIS configuration (all Parts of IIS like all sites and application pools) on windows 2016 server and 2019 server, and store them in a specific folder, do you have any idea in order to do that?

thanks

Questioner
Hadi Farzipour
Viewed
0
Theobald Du 2021-03-15 16:14:12

Backup of website data and configuration running on the Internet Information Service web server consists of several steps:

  1. Backup of website files (by default, they are stored in %SystemDrive%\inetpub\wwwroot). This directory must be included to the backup plan to create its copy using backup tools or your own scripts
  2. Backup (export) of current IIS certificates (you can get the list of SSL certificates on the server using this command: netsh http show sslcert)
  3. Backup of IIS configuration (settings) We’ll show how to create a backup of IIS configuration on one server and restore it on another one.

Using appcmd, create IIS configuration backup on first server. To do it, run the command prompt with the administrator privileges and go to the following directory:

cd c:\Windows\system32\inetsrv

Create the IIS configuration backup with name srviis1-backup-20161107:

appcmd add backup srviis1-backup-20161107

After the command has been executed, a folder with your backup name appears in c:\Windows\system32\inetsrv\backup. Here is its contents for my simple website:

  • administration.config

  • applicationHost.config

  • MBSchema.xml

  • MetaBase.xml

  • redirection.config Copy the backup folder to the same directory c:\windows\system32\backup on another server.

To display the list of all available backups, run the following command:

appcmd list backup

Recover IIS configuration from this backup:

appcmd restore backup srviis1-backup-20161107

The string Restored configuration from backup “srviis1-backup-20161107″ means that IIS configuration has been successfully recovered.

Note. There are entries like BACKUP “CFGHISTORY_0000000001” in the list of available backups. These are IIS configuration backups created automatically and located in \inetpub\history. Automatic backup has appeared in IIS since IIS 7: the changes in ApplicationHost.config are being monitored, 10 latest backups are stored and the file is checked for changes every 2 minutes.

The list of restrictions and important issues.

  • The same IIS version has to be used on both servers
  • If any application pool is run not from the integrated accounts, they have to be available on another server as well
  • Before recovery, you should export and migrate all current certificates to the new server

Here you can refer to:How To Backup and Restore IIS configuration to Another Server