How do I elevate privileges when running appcmd from a nant task?

Posted by Rune on Server Fault See other posts from Server Fault or by Rune
Published on 2010-07-23T15:07:58Z Indexed on 2012/06/19 3:18 UTC
Read the original article Hit count: 614

Filed under:
|
|
|

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.

© Server Fault or respective owner

Related posts about scripting

Related posts about iis7.5