Issue is with a Windows 7 system with latest updates, on a network with Windows 2008r2 server in an non-AD non-domain environment.
From File Explorer, or within an application, I can access \\server\share using saved credentials. I have read/write access according to rights of account for user on server. From a command window, I can type "net use \\server\share" and will get some details, followed by "command completed successfully".
From a CMD batch file launched from scheduled task, net use \\server\share will sometimes hang the script because it is prompting for username and password.
I can see the failed schedule task window frozen with the prompt. I can launch another command window and type "net use \\server\share" and it works.
If I re-run the scheduled task from Task Scheduler it will run successfully and not hang on Net Use. Only when the task is started by the system does it seem to have problems with logging in.
Why does net use sometimes ask for credentials (which are saved on the local machine)? How can I cause this schedule task to run reliably?