IIS Site Copy

Install dependencies

First you need to know what IIS plugins are installed, this is not an automated process so you need to know all the "plugins" installed that make your website work, many plugins will be "Microsoft Corporation" so to search for those enter this:

Get-WmiObject -Class Win32_Product | where vendor -eq "Microsoft Corporation" | select Name, Version

If you have custom products then you will need to use this version which will give you all the software installed:

Get-WmiObject -Class Win32_Product | select Name, Version

This is a sample list for the purposes of illustration:

Browser for SQL Server 2022                                                 16.0.1000.6
Microsoft Help Viewer 2.3                                                   2.3.28307
SQL Server 2022 DMF                                                         16.0.1000.6
SSMS Post Install Tasks                                                     19.0.20200.0
Microsoft Visual Studio Production Diagnostics Instrumentation Engine (x64) 2.0.23.0
Microsoft Analysis Services OLE DB Provider                                 15.0.2000.832
IIS URL Rewrite Module 2                                                    7.2.1993
SQL Server 2022 Database Engine Shared                                      16.0.1000.6
SQL Server 2022 SQL Diagnostics                                             16.0.1000.6
Microsoft VSS Writer for SQL Server 2022                                    16.0.1000.6
SQL Server 2022 Batch Parser                                                16.0.1000.6

The one here is bold we need to install this is the URL rewrite module, which is required on the new server, for the extension you can get that here:

English: 
x86 installer / x64 installer

Also note if you have custom .net languages this will need to be installed on the new server as well, usually its backwards compatible, then you are good to move on.

Copy Folder Structure

You need the folder structure for all the files to work when you import the IIS configuration later on, to get this from the old server open up IIS Manager then choose Sites then you will see the path to the files and folders as below:


The structure and the by definition the web.config and other files needs copying from the old sever to the new server in the same folder path.

Export

Then you need to export your old server data, not the metadata but the XML

%windir%\system32\inetsrv\appcmd list apppool /config /xml > c:\backup\apppools.xml
%windir%\system32\inetsrv\appcmd list site /config /xml > c:\backup\sites.xml

Import

WARNING : Before running the load in site command, please edit the xml to change the site value from 1 to 2, this also needs to be done on the Application Pools XML file as well, if you do not do this you'll have a conflict loading it in.

%windir%\system32\inetsrv\appcmd add apppool /in < c:\backup\apppools.xml
%windir%\system32\inetsrv\appcmd add site /in < c:\backup\sites.xml

Restart IIS

iisreset /noforce


Previous Post Next Post

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