Mercurial pull across network drive in powershell script from scheduled task

1

So I previously had this question: Mapped Drive inaccessible from Windows Scheduled task in which I discovered how to get access to a drive a python script I was running needed to put files in. I thought this would work for other activities as well but I am trying to do a mercurial pull and have errors that the folder cannot be found.

A simplified version of the script with just the problem parts is:

net use Z: \\esc-msc\SourceRepo >> run_bsd.log
hg pull 2>&1 >> run_bsd.log

which gives the result in the log file

The command completed successfully.

hg : abort: repository Z:\BSD_ETL not found!
At C:\Users\servacctdwdev\Desktop\BSD_ETL\run_bsd.ps1:2 char:1
+ hg pull 2>&1 >> run_bsd.log
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (abort: repository Z:\BSD_ETL not found!:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

now I tried the solutions of pushd and what not mentioned in the other question to no avail. I guess something additional besides net use needs to be done to allow mercurial access in this scheduled task?

lathomas64

Posted 2015-11-09T22:46:26.613

Reputation: 193

This works if I run the script directly by right click > run with powershell but not if I have a schedule task run it form the folder. – lathomas64 – 2015-11-10T14:34:17.330

Answers

1

I worked around this problem for mercurial by re-cloning the repo using the full UNC path instead of the mapped drive path.

lathomas64

Posted 2015-11-09T22:46:26.613

Reputation: 193