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.

<target

name="iis.reset" >

<echo


message="Restarting iis" />

<servicecontroller


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

<servicecontroller


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


<

/target>

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?

Thanks.
2 comments

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

0

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 !

0

Please sign in to leave a comment.