# How to migrate IIS websites to a new server

> Step by step, how to migrate IIS websites to a new Windows Server with Web Deploy (msdeploy), robocopy, icacls, appcmd and certificate exports, plus where a panel such as Zopanel saves work.

Source: https://zopanel.net/windows/blog/migrate-iis-websites-new-server  
Updated: 2026-11-27

## Key takeaways

- To migrate IIS websites to a new server, move four things separately: configuration (sites, pools, bindings), content, permissions and certificates.
- Web Deploy (msdeploy) can sync configuration and content; robocopy and icacls give you control over files and ACLs.
- Application pool identities keep the same SID when the pool name is the same, but local Windows accounts do not.
- Always rehearse with a hosts file before changing DNS, and keep the old server running for at least the old TTL.

To migrate IIS websites to a new server, you move four things: the IIS configuration (sites, application pools, bindings), the content, the file permissions, and the certificates. Microsoft's Web Deploy tool (`msdeploy.exe`) can move configuration and content in one step. For more control, export configuration with `appcmd`, copy files with `robocopy`, save ACLs with `icacls`, and export certificates as PFX files.

This guide gives the commands for both ways, then shows where a hosting panel helps. Run every step on a test copy first.

## Before you start

On both servers:

- Install the same IIS role services and modules (URL Rewrite, ARR, ASP.NET 4.8, PHP versions) on the new server. Missing modules break sites silently.
- Use the same or newer Windows Server version on the target.
- Lower DNS TTLs to 5 minutes at least a day before the cutover.

Compare installed IIS features:

```powershell
Get-WindowsFeature Web-* | Where-Object Installed | Select-Object Name |
  Export-Csv C:\migration\iis-features.csv -NoTypeInformation
```

Run it on both servers and compare the files.

## Option 1: Web Deploy (msdeploy)

Install Web Deploy on both servers. On the target, the Web Management Service (WMSvc) must run and listen on port 8172 if you push remotely.

### Check dependencies

```powershell
$msdeploy = 'C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe'
& $msdeploy -verb:getDependencies -source:appHostConfig="example.com"
```

The output lists the modules, handlers and authentication methods the site uses. Install anything missing on the target first.

### Package one site

```powershell
& $msdeploy -verb:sync -source:appHostConfig="example.com" `
  -dest:package=C:\migration\example.com.zip -enableLink:AppPoolExtension
```

`appHostConfig` covers the site's configuration and its content. `-enableLink:AppPoolExtension` also brings its application pool.

### Restore on the new server

Copy the zip, then preview with `-whatif` before the real run:

```powershell
& $msdeploy -verb:sync -source:package=C:\migration\example.com.zip `
  -dest:appHostConfig="example.com" -enableLink:AppPoolExtension -whatif
```

Remove `-whatif` when the preview looks right. You can also push directly from the old server to the new one with `-dest:appHostConfig="example.com",computerName="https://new-server:8172/msdeploy.axd",userName="admin",password="...",authType="Basic"`; add `-allowUntrusted` only if WMSvc still has its self-signed certificate.

To package a whole server, use `-source:webServer`. That copies every site and global setting, which is only safe when the target is a clean server with the same Windows version.

## Option 2: by hand, step by step

### 1. Export pools and sites with appcmd

```powershell
$appcmd = "$env:windir\system32\inetsrv\appcmd.exe"
& $appcmd list apppool /config /xml > C:\migration\pools.xml
& $appcmd list site /config /xml > C:\migration\sites.xml
```

Edit the XML before importing: remove the default pools and the Default Web Site, which already exist on the target, and change physical paths if the drive layout differs. Then import in `cmd.exe`, pools first:

```bat
%windir%\system32\inetsrv\appcmd add apppool /in < C:\migration\pools.xml
%windir%\system32\inetsrv\appcmd add site /in < C:\migration\sites.xml
```

Run these from `cmd.exe`, because PowerShell does not support the `<` redirection.

### 2. Copy content with robocopy

```powershell
robocopy D:\sites \\new-server\D$\sites /MIR /COPY:DATS /DCOPY:DAT /R:1 /W:1 /MT:16 `
  /XD logs /LOG:C:\migration\robocopy.log
```

`/COPY:DATS` copies data, attributes, timestamps and NTFS security. Run it once while the old sites are live, then again during the cutover window; the second run only copies changes. Be careful with `/MIR`: it deletes files on the target that are not on the source.

### 3. Permissions

Two kinds of accounts appear in site ACLs:

- **Application pool identities** (`IIS AppPool\example.com`). Their SID is derived from the pool name, so the same pool name on the new server gives the same SID, and copied ACLs keep working.
- **Local Windows users** (for example an FTP user per site). Their SIDs are different on every server. Copied ACLs show unknown SIDs; recreate the users and grant again.

To save and restore ACLs separately:

```powershell
icacls D:\sites\* /save C:\migration\acl.txt /t /c
# on the new server, after copying files to the same path:
icacls D:\sites\ /restore C:\migration\acl.txt
```

Or set permissions fresh per site, which is cleaner:

```powershell
icacls D:\sites\example.com /grant "IIS AppPool\example.com:(OI)(CI)M"
```

### 4. Certificates and HTTPS bindings

Export each certificate with its private key on the old server:

```powershell
$pw = Read-Host -AsSecureString 'PFX password'
Get-ChildItem Cert:\LocalMachine\My | Select-Object Thumbprint, Subject, NotAfter
Export-PfxCertificate -Cert Cert:\LocalMachine\My\<thumbprint> -FilePath C:\migration\example.pfx -Password $pw
```

This only works if the key was imported as exportable. Let's Encrypt certificates are simpler to reissue on the new server after DNS moves.

On the new server, import and bind:

```powershell
Import-PfxCertificate -FilePath C:\migration\example.pfx -CertStoreLocation Cert:\LocalMachine\My -Password $pw
Import-Module WebAdministration
New-WebBinding -Name 'example.com' -Protocol https -Port 443 -HostHeader 'example.com' -SslFlags 1
(Get-WebBinding -Name 'example.com' -Protocol https -HostHeader 'example.com').AddSslCertificate('<thumbprint>', 'My')
```

`-SslFlags 1` turns on SNI, so several sites can share one IP on port 443. Check the result with `netsh http show sslcert`.

### 5. Databases and connection strings

Back up SQL Server databases with `BACKUP DATABASE ... WITH COPY_ONLY` and restore them; dump MySQL with `mysqldump --single-transaction`. Recreate logins on the new server, and update connection strings in `web.config` if names or passwords change.

## Test before DNS

Point your own PC at the new server with the `hosts` file:

```text
198.51.100.20  example.com www.example.com
```

Check pages, sign-in, uploads (write permissions), scheduled tasks and outgoing mail. Then, in a short read-only window, run the final robocopy and database copy, switch DNS, and keep the old server running for at least the old TTL.

## Where Zopanel for Windows helps

A panel reduces the hand work, within limits we state:

- **Between two Zopanel servers**, PHP sites with MariaDB move from the panel: the old copy keeps serving until the new one is verified, then a final sync, with a way back. Status: available. Sites with PostgreSQL or SQL Server, Node/.NET/Python apps and mail cannot be moved this way yet. See [/features/fleet](/windows/features/fleet).
- **From an old IIS or Plesk server**, an import tool runs once on the source and copies sites and MySQL databases into the panel. Status: experimental. See [Migrate from Plesk](/windows/docs/migration-plesk).
- **On the new server**, each site gets its own pool identity and ACLs, and Let's Encrypt certificates are issued and renewed without manual binding. Purchased certificates cannot be uploaded for websites yet.
- **Web Deploy publishing** per site, with a per-site IIS Manager user and a `.publishsettings` file for Visual Studio. Status: limited. See [ASP.NET](/windows/docs/aspnet).

For a full Plesk move, read [Migrating from Plesk for Windows](/windows/blog/migrate-from-plesk-windows).

## FAQ

### What is the fastest way to migrate IIS websites to a new server?

Web Deploy with `appHostConfig` per site, or `webServer` for a whole server going to a clean target with the same Windows version.

### Do NTFS permissions survive the move?

Permissions for application pool identities do, when the pool names stay the same. Permissions for local Windows users do not; recreate the users and grant again.

### Can I move certificates with Web Deploy?

Certificates are separate from site content. Export them as PFX with their private key, or reissue Let's Encrypt certificates on the new server.

### How long should I keep the old server?

At least the old DNS TTL, ideally 24 to 72 hours, so late visitors and mail still reach a working server.

## Move to a managed setup

If you are moving anyway, consider moving into a panel that keeps isolation and certificates in order for you. [Download Zopanel for Windows](/windows/download) and try it with a few sites on the Free plan; see [pricing](/windows/pricing) for larger fleets.
