NANT script in TeamCity: Cannot open w3svc service on computer '.'

:^OHopefully, there is a quick an simple answer for this, but I can't seem to place my finger on it right now.

Here is the issue:

I have a Nant script with a iis restart task that uses to w3svc service on the server that iis needs resetting. The execution of this task works great from the command line and does exactly what needs to be done.


name="iis.reset" >


message="Restarting iis" />


action="Stop" service="w3svc" machine="myServer" timeout="10000" verbose="true" />


action="Start" service="w3svc" machine="myServer" timeout="10000" verbose="true" />



When I try testing this on TeamCity it gives me the following error?

Cannot open w3svc service on computer 'myServer'.

Does anyone know why this is happening and how can I get around this?

Comment actions Permalink

Please check the user account that is used to run the build agent service.

Comment actions Permalink

Thank you very much. That was exactly it. I changed the Local System account to a network service acount and everything worked out great.

Thanks again !


Please sign in to leave a comment.