Is it possible in Windows 10 to run a scheduled task only if a mapped network drive is not present?
I have a task, a batch script, that maps two network drives for a backup service (CrashPlan). The batch script checks if the drive is present
if exist Y:\ (...) and maps it otherwise
net use Y: ....
This works, but since these network paths might not be present at system start or login (NAS switched off when I start my computer), I need to repeat this task regularly to ensure that the drives are mapped if/when the network paths become available.
But I really only need to repeat the task if the drive hasn't already been mapped, so I'd like to skip the task whenever the drives are aready present.
There's no harm in running the task anyway - it just skips the
net use command, but the log would be cleaner if I could skip the task when it's not needed.
The underlying "problem" is to make sure the two mapped drives are always present to the CrashPlan service, running under the SYSTEM account, whenever the network paths are available (the NAS devices are online). Feel free to suggest completely different approaches to this, but perhaps try to keep those in comments, to avoid cluttering this question's answer. I'd be happy to post such a question separately if adviced to do so.