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?

  • 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 Nov 10 '15 at 14:34

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.