I know that using IIS Manager, I can save the configuration for an IIS site to a file, go to a new machine and then create a new web site from that (XML) file.

My question is: How can I automate the creation a website using a saved configuration (xml) file?

Bonus points for answers that let me do this with IIS 6.0


You can synch (and thus effectively transfer) sites between servers using the Web Deployment Tool. Specifically, there is a quide to doing this in IIS 6.0.


If you want to stay away from writing your own serialization and deserialization mechanism for the metabase data, you can use the code that Microsoft uses in the Export/Import XML functionality in the IIS console. Yo' re going to have to write code to interface with it, but the API is there to do what you want starting in IIS 6.

Have a look at the IMSAdminBase2 object, and specifically the IMSAdminBase2::Export and IMSAdminBase2::Import methods.

You could use ADSI to accomplish what you're looking for, but then you're talking about enumerating the metabase, serializing the data yourself into your own proprietary XML schema, then deserializing it and importing it into the metabase on the destination server yourself. I'd avoid that, personally.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.