Home > Uncategorized > Moving IIS sites using AppCmd

Moving IIS sites using AppCmd

Backup Process

%windir%\System32\inetsrv>appcmd list apppool /config /xml >C:\temp\apppools.xml
%windir%\System32\inetsrv>appcmd list sites /config /xml >C:\temp\sites.xml
… And all your website files

Zip up all these files, and move them to the destination server.

Restore Process

… Restore all your website files from the zip file.

Then Edit the apppools.xml file, and comment out any appPools that are already present in the destination server, for example
“DefaultAppPool” etc.

Then … Import App Pools using:

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

Step 2.
Edit the Sites.xml file, and comment out any websites that are already present in the destination server, for example “Default website” etc

Edit the sites.xml file, and change the Site.ID=”<number>” and ID=”<number>” attributes so that they are larger than the largest Site ID in IIS.

Important: If you import a site with the same site ID as an existing site, then the entire server will crash

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

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment