Unable to run batch script as Windows server 2008 R2 Scheduled Task using option "Run wheter user is logged in or not

Hi there,

I'm using Windows server 2008 R2 on one of my Pro Env, I have two batch files (See Block code)

Both should run when the user is logged off however only batch file number 1 is working

All setting are the same

any help will be great

P.S I'm straggling around this issue fora while

Please note the script contain access to a network drive p:\ and I think this is the issue I even try to include "net use" with user name and password in the script but no success.

May be I should use a different command like "remove item" in power shell

Batch 1:

set path="C:\Program Files\WinRAR\";%path%

cd D:\Xsense Services\Protocol\Logs

winrar a -df -ep -agDD-MMM-YYYY-NN Protocol_.rar -x*.txt

move *.rar \\xs-nas\Public\XS-App1\PP1

cd "D:\Xsense Services\ProtocolComm3\Logs"

winrar a -df -ep -agDD-MMM-YYYY-NN ProtocolComm3_.rar -x*.txt

move *.rar \\xs-nas\Public\XS-App1\PP3

cd "D:\Xsense Services\ProtocolZespri\Logs"

winrar a -df -ep -agDD-MMM-YYYY-NN ProtocolZespri_.rar -x*.txt

move *.rar \\xs-nas\Public\XS-App1\PP2

Exit

Batch 2

forfiles /p "P:\XS-App1\PP1" /s /m *.rar /c "cmd /c Del @path" -d -90
forfiles /p "P:\XS-App1\PP2" /s /m *.rar /c "cmd /c Del @path" /d -90
forfiles /p "P:\XS-App1\PP3" /s /m *.rar /c "cmd /c Del @path" /d -90
Exit


August 22nd, 2015 4:24am

update

issue has been fix here is the notes:

1. Before adding the "net use" to the script the scheduler error was 0x1

2. After adding "net use" the scheduler error was 0x8004131F more info can be found here:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa383604%28v=vs.85%29.aspx

After visit the page I change the rule under Setting " If the task is already running, then the following rule applies" and chose "Stop the existing instance"

Thx for your help

Manny

Free Windows Admin Tool Kit Click here and download it now
August 22nd, 2015 5:53am

update

issue has been fix here is the notes:

1. Before adding the "net use" to the script the scheduler error was 0x1

2. After adding "net use" the scheduler error was 0x8004131F more info can be found here:

https://msdn.microsoft.com/en-us/library/windows/desktop/aa383604%28v=vs.85%29.aspx

After visit the page I change the rule under Setting " If the task is already running, then the following rule applies" and chose "Stop the existing instance"

Thx for your help

Manny

August 22nd, 2015 9:48am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics