CMD : Migrating IIS configurations between servers

If you've ever tried upgrading from Windows Server 2012 R2 to Server 2016 and encountered the irritating "Windows SKU changed" error with your IIS configuration becoming corrupt, you're not alone. This common issue can cause significant headaches for system administrators, but there's a simple command line solution using appcmd.exe that can save you time and frustration.


Understanding the Problem

When performing an in-place upgrade between different Windows Server versions (like 2012 R2 to 2016), IIS configurations often become "corrupt" due to:

  • Different IIS Versions: Server 2012 R2 uses IIS 8.5, while Server 2016 uses IIS 10.0
  • Configuration Schema Changes: Each version has different configuration structures
  • Feature Set Differences: Available features vary between versions
  • Security Model Updates: Changes in how configurations are secured and accessed

The Windows Server upgrade process attempts to migrate your IIS configuration automatically but frequently fails because of these differences, reporting the configuration as corrupt and often removing it entirely.

The Appcmd Solution: Export and Import

Rather than relying on Windows to handle the migration during an upgrade, a more reliable approach is using the appcmd.exe utility to export and import your IIS configuration.

Export Process on Server 2012 R2

Open an administrative Command Prompt on your Server 2012 R2 machine and run:

%windir%\system32\inetsrv\appcmd.exe add backup "IISBear"

This creates a backup in the following location:

%windir%\System32\inetsrv\backup\IISBear

Import Process on Server 2016

Copy the backup folder from the old server to the same path on your Server 2016 machine:

%windir%\System32\inetsrv\backup\IISBear
Open an administrative Command Prompt on the Server 2016 machine and run:
%windir%\system32\inetsrv\appcmd.exe restore backup "IISBear"

Verification

Verify your configuration was successfully imported:

%windir%\system32\inetsrv\appcmd.exe list site
%windir%\system32\inetsrv\appcmd.exe list apppool

Best Practices for Successful Migration

  • Install identical IIS features on the new server before importing
  • Test the migration in a staging environment first
  • Create a backup of the destination server's configuration before importing
  • Use the following appcmd command to stop all sites before migration if needed:
    %windir%\system32\inetsrv\appcmd.exe stop site /site.name:"Bears"
    

Conclusion (easy with hindsight)

The appcmd approach to migrating IIS configurations between Windows Server versions offers a reliable path when facing "Windows SKU changed" errors. By exporting from your old server and importing to a clean installation of the new server, you can avoid configuration corruption issues, saving time and ensuring a smoother transition to your new server platform.

Previous Post Next Post

نموذج الاتصال