Hello *,
we have got an ant script which should access a remote system after building a java project to distribute it.
The target in our build.xml looks like this:
<!-- ==================== Run deployment Target ============================= -->
<target name="deployment" description="deploy project to test server">
<!-- kill running test server on remote system -->
<exec executable="cmd.exe">
<arg line="/c taskkill /S ip.of.remote.system /U user_of_remote_system /P password_of_remote_system /IM cmd.exe /T"/>
</exec>
<!-- build, unzip and other stuff -->
[ ... ]
<!-- delete old folders on test server-->
<delete dir="${testserver.mappeddir}/${app.name}" />
[ ... ]
<!-- move folders to test server (name without version number) -->
<move file="${tempdir}/${dist.name}" tofile="${testserver.mappeddir}/${app.name}"/>
[ ... ]
<delete dir="${tempdir}" />
<!-- start test server -->
<exec executable="psexec.exe">
<arg line="\\ip.of.remote.system -d -i -u user_of_remote_system -p password_of_remote_system -w D:/Test-Server cmd /c "1 Test-Server starten.lnk""/>
</exec>
</target>
${testserver.mappeddir} points to a folder on the remote system (is mapped as a network drive Z: on the build system). The network drive connection is established by an admin user on each startup/ logon. Running the script from command line within this user account works just fine but running it from TeamCity the build fails with the following error message:
It seems that TeamCitys Build service runs on the local system account and has no rights to access the remote system (or the mapped drive due to its establishment by a specific user). So we changed the service "TeamCity Build Agent Service" to run with the admin user which leads to another error message:
