Search code examples
c#.netnant

Nant task copy UNC with a drive specified (eg. \\server\c$\program files\blah)


I would like to use Nant to copy files to a path like \\server\c$\program files\blah.

To access this path, I first need to go \\server\c$ and enter and user and password, then the former path will work.

Is there any way to do this automatically in Nant.

I don't want to expose the folder as a share, security is tight and the share may get removed, especially since it will require write permissions.


Solution

  • You have 2 options, start the nant script with a user that has access to that admin share, or exec a runas in the nant script for the copy. The runas will require you to put the password in clear text.