A job started by the task scheduler doesn't have access to mapped drives outside the scope of the job. Try mapping the drive as part of the job. E.g., NET USE B: \server\directory -- or, better, don't depend on mapped drives; use the UNC name instead.
Powershell and mapped drive
I have a .bat script that is called by a windows task scheduler job.
It is run by an account of sys$pAdmin in windows task scheduler,
in the .bat file there are some database refresh tasks, then later in the script there is a call to a powershellscript like this:
..........
start powershell.exe -ExecutionPolicy Bypass -command "B:\Backup_Scripts\SetImageServer.ps1 F:\oradata\psproddb\data_pump_dir\rman_dup_%LOG_DAY%.log | Out-File F:\oradata\psproddb\data_pump_dir\rman_dup_%LOG_DAY%_2.log"
There is nothing recorded in the log for it.
I know B drive is a mappped drive, And I cannot find a mapped drive of B:, and nothing mentioned in the script about mapping B drive,
Is there a way I can see if it has a mappped drive setup?
THanks,