How do I make a copy of my IIS configuration and restore it or move it to a new system?

In some cases, it is helpful to backup the IIS configuration to be restored in case of emergency or to add it to another system. Here is how you can do it.

 

🛠️ Step 1: Backup IIS Configuration on the Source Server

Option A: Using appcmd (built-in tool)

  1. Open Command Prompt as Administrator
  2. Navigate to the IIS directory:
  1. cd %windir%\system32\inetsrv
  1. Create a backup:
  1. appcmd add backup MyIISBackup

This creates a folder under C:\Windows\System32\inetsrv\backup\MyIISBackup containing config files like:

    • applicationHost.config
    • administration.config
    • MBSchema.xml
    • MetaBase.xml
    • redirection.config

Option B: Using PowerShell

Backup-WebConfiguration -Name "MyIISBackup"

 

🔐 Step 2: Export SSL Certificates (if used)

If your sites use SSL:

  1. Open MMC and add the Certificates snap-in for Local Computer.
  2. Locate your certificate under Personal > Certificates.
  3. Right-click > All Tasks > Export (choose .pfx format and include the private key).
  4. Save to a secure location.

 

📁 Step 3: Copy Backup Files to the Target Server

  • Copy the entire backup folder from:
  • C:\Windows\System32\inetsrv\backup\MyIISBackup

to the same path on the new server.

  • Also copy any website content from:
  • C:\inetpub\wwwroot

or wherever your sites are stored.

 

🔄 Step 4: Restore IIS Configuration on the Target Server

Option A: Using appcmd

  1. Open Command Prompt as Administrator.
  2. Navigate to the IIS directory:
  1. cd %windir%\system32\inetsrv
  1. List available backups:
  1. appcmd list backup
  1. Restore the backup:
  1. appcmd restore backup MyIISBackup /stop:true (no space after "/")

Option B: Using PowerShell

Restore-WebConfiguration -Name "MyIISBackup"

 

⚠️ Important Notes

  • Ensure both servers use the same IIS version.
  • Re-import any SSL certificates before restoring.
  • If you use custom application pool identities, recreate those accounts on the new server.