We are using a Windows 7 box as build server.
As part of our continuous integration process I would like to stop and start an IIS 7 website. I have tried doing this from the command line using appcmd:
appcmd start site "my website"
However, this only works if I start the console window by choosing "Run as Administrator", so it won't work out-of-the-box from NAnt etc.
How do I script appcmd to be run with elevated privileges (or am I going about this in the wrong way)?
Thank you.
Best Answer
This is NOT an advisable approach at all, due to security concerns...
But, if you grant read permissions to the service that is executing the
appcmd
to the fileapplicationHost.config
file located in the%windir%\system32\inetsrv\config
directory, you you should be able to execute a.bat
file withappcmd
commands inside of it from CruiseControl (at least in my case).I did this on a Windows Server 2008 Build Server.