I have a service running, on windows Server 2008 R2, which requires access to a webdav mapped drive, for copying file dependencies. Everything works when I run net use from command prompt:
net use z: https://domain.com/webdav /user:thisuser passwd
or run my script from command prompt, an ant build script:
<target name="mapdrive.developer" depends="checkmappeddrive" unless="mapped.drive.present">
<antcall target="disconnect.mapped.drive" />
<echo message="Mapping drive..." />
<exec executable="net">
<arg value="use" />
<arg value="z:" />
<arg value="https://test.com/plugins/servlet/confluence/default" />
<arg value="/PERSISTENT:YES" />
<arg value="/USER:xxxxx" />
<arg value="xxxxx" />
</exec>
</target>
Yes, it is an SSL/HTTPS webdav map. I'm aware of the system settings in the registry and have the WebClient, "Desktop Experience", installed. Everything works fine when logged in and running from command prompt. However, if I take this script and spawn the script from my build service, which runs as Local System account, the command fails with the error: "System error 67 has occurred.". I've tried enabling 'Allow service to interact with desktop' and changing the 'Log on as' setting to a regurlar user. Neither worked. I've searched and found similar issues with people having success mapping drives as user, but failing when ran from scripts as a service, local system account. What I cant find is a workaround, if any.
Anybody here find a working solution to this? Any info greatly appreciated.
Figured it out. You have to use UNC paths to copy from remote sources and running as a local service. Apparently, this was answered on stackoverflow:
Drive letters won't work. So if you're coping files from wedav/https, with ssl enabled, you have to map the source using UNC:
net use https://test.net/plugins/servlet/confluence/default /user:user passwd
Then when you exec 'net use' you will see the following:
I used robo copy to copy from the UNC: