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.

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:
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
$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
& $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:
& $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
$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:
%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
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:
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:
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:
$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:
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:
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.
- 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.
- 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
.publishsettingsfile for Visual Studio. Status: limited. See ASP.NET.
For a full Plesk move, read Migrating from Plesk for 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 and try it with a few sites on the Free plan; see pricing for larger fleets.
Put your Windows servers on Zopanel
Start free with 1 server and 10 websites on Windows Server 2022 or 2025, or talk to us about moving from Plesk and about licenses for several servers.
Free for 1 server, 10 websites · No credit card · Signed MSI
Keep reading

Free SSL certificate on IIS with Let's Encrypt: ACME, SNI bindings and renewal
How to get a free Let's Encrypt SSL certificate for IIS on Windows Server: how ACME validation works, how to bind certificates with SNI for many sites on one IP, how renewal must be automated, and how win-acme and Zopanel each handle it.

Hosting ASP.NET and PHP side by side on IIS
A practical guide to running PHP, ASP.NET 4.x, ASP.NET Core and Classic ASP sites on one Windows Server with IIS, and what a panel should handle for you.

How to deploy ASP.NET Core to IIS: Hosting Bundle, web.config and 500.30 fixes
Step by step, deploy an ASP.NET Core app to IIS on Windows Server: install the Hosting Bundle, pick in-process or out-of-process hosting, set up a No Managed Code pool and web.config, and fix 500.30, 500.31 and 502.5.