I have been looking into the Microsoft.Web.Administration.dll and the ServerManager class, trying to control our Windows Server 2008 IIS 7 instance.
I have enabled remote administration and can connect via the IIS remote administration tool. However, when I try and use the following, I cannot connect:
ServerManager.OpenRemote(serverName);
This class does not allow me to specify a username and password on the remote IIS 7 server, as the IIS remote administrator tool does.
This is all being called via our build process using NAnt.
How do others control their remote IIS 7 server as part of their CI setup?
I wrote a WCF service in the end, which runs on the remote machine as a service. The service runs under a local account with administrator rights so that the local IIS instance on that machine can be changed.
From my NAnt script I have a series of custom tasks that communicate to the WCF service and change IIS settings as required.
As this is an internal dev environment I am not too concerned about security and the actual changes to IIS I am allowed are very basic.