by Mikael Henriksson
26. August 2009 14:43
First of all we set up a DFS (Distributed File System) because having to copy the website files from Team City to two or three servers is a pain in the a**. Now we only copy the files to one server and it is synchronized with the others but hey what if you need to change something in the IIS manager? Well then there is the Web Deployment Tool. First install it then use it.
The following script should be run from server01 to synchronize the changes to server02. It does not take a backup of server02’s current configuration. It also does not create any application pools (have not figured that one out yet). First open a command prompt as administrator (otherwise it will give you a nice explanation about why). Second: in command prompt, navigate to “C:\Program Files\IIS\Microsoft Web Deploy” and then run the following two commands.
msdeploy -verb:getDependencies -source:apphostconfig="www.domain.com"
msdeploy -verb:sync -source:apphostconfig="www.domain.com" -dest:apphostconfig="www.domain.com",computername=server02 -whatif > msdeploysync.log
Forgot to mention the www.domain.com is actually the name of the website in IIS manager. The first line is to make a configuration out of dependencies. The second line executes this config against the server of your choice (-computername)