Schedule Task - Windows 2008 R2 - User Session
-
Wednesday, February 06, 2013 7:55 AM
I am migratiing the schedule task from windows 2003 to windows 2008 and find some of behaviour change on handling user session by Task Scheduler.
I have a simple batch to call "net use" command to map a network drive for copying file to remote server. And I have scheduled 3 similar tasks and run as same user (e.g. testuser)
In windows 2003 enviornment, the mapped network drive resource will not be accessed by another schedule task. In windows 2008 R2, howerver, the network drive mapped in one of schedule task can be reached by another task. Does anyone have idea on this behaviour change?
Here are the testing script
Test Script 1
NET USE >> D:\TEST1.LOG
NET USE Z: \\127.0.0.1\Share /PERSISTENT:NO >> D:\TEST1.LOG
ping 127.0.0.1 -n 100
NET USE Z: /DELETETest Script 2
NET USE >> D:\TEST2.LOG
NET USE Z: \\127.0.0.1\Share /PERSISTENT:NO >> D:\TEST1.LOG
ping 127.0.0.1 -n 100
NET USE Z: /DELETETest Script 3
NET USE >> D:\TEST3.LOG
NET USE Z: \\127.0.0.1\Share /PERSISTENT:NO >> D:\TEST3.LOG
ping 127.0.0.1 -n 100
NET USE Z: /DELETEOutput in Windows 2003
Test1.LOG
New connections will not be remembered.
There are no entries in the list.
The command completed successfully.
z: was deleted successfully.
Test2.LOG
New connections will not be remembered.
There are no entries in the list.
The command completed successfully.
z: was deleted successfully.
Test3.LOG
New connections will not be remembered.
There are no entries in the list.
The command completed successfully.
z: was deleted successfully.
Output in Windows 2008
Test1.LOG
New connections will not be remembered.
There are no entries in the list.
The command completed successfully.
z: was deleted successfully.
Test2.LOG
New connections will not be remembered.
Status Local Remote Network-------------------------------------------------------------------------------
OK Z: \\127.0.0.1\Share Microsoft Windows Network
The command completed successfully.System error 85 has occurred.
The local device name is already in use.
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
Test3.LOG
New connections will not be remembered.
Status Local Remote Network-------------------------------------------------------------------------------
OK Z: \\127.0.0.1\Share Microsoft Windows Network
The command completed successfully.System error 85 has occurred.
The local device name is already in use.
The network connection could not be found.
More help is available by typing NET HELPMSG 2250.
All Replies
-
Wednesday, February 06, 2013 8:55 AM
I may be looking at this wrong are your tasks running over the top of each other try putting in a timestamp at the bottom and top of your logs, if they do over lap or Z: is not removed correcly then it will not work as the letter would be in use. I would reconmend doing what your tasks are doing by hand if possible and seeing what happens log files are fine but dont always show the full picture. Would it also be possible for you to give us a step by step of what you are tring to do as your post is confusing.
Also if you do it by hand you can confirm that each task is able to map the drives you are tring to map as it may be they cant see the network share.
8B17
- Edited by 8B17 Wednesday, February 06, 2013 8:56 AM
-
Wednesday, February 06, 2013 9:05 AM
1. It seems that the script does not complete properly. Just tested in W 8 environment and it works properly.
2. I would double check permissions.
Regards
Milos
- Edited by Milos PuchtaMicrosoft Community Contributor Wednesday, February 06, 2013 9:06 AM
-
Wednesday, February 06, 2013 10:42 AM
Sorry for confusing, I have udpated the script for this testing
=====================================================
Script for Schedule Task 1 - to map a network drive and issue a ping command to "sleep"
Echo %date% %time% list drive on schedule task 1
NET USEEcho %date% %time% map drive on schedule task 1
NET USE Z: \\127.0.0.1\Share /PERSISTENT:NOping 127.0.0.1 -n 100 > NUL
Echo %date% %time% remove drive on schedule task 1
NET USE Z: /DELETEScript for Schedule Task 2 - to list out any network drive are mapped.
Echo %date% %time% list drive on schedule task 2
NET USE========================================================================
The schedule task 2 are triggered while the schedule task 1 are running, In the windows 2003, the schedule task 2 could not list out any mapped drive. In the windows 2008, however, the schedule task 2 can list the network drive mapped by schedule task 1. The question is if there are any changes between windows 2003 and 2008, hope it can clarify.
Ouput on windows 2003
Schedule task1
D:\>Echo Wed 02/06/2013 18:31:52.93 list drive on schedule task 1
Wed 02/06/2013 18:31:52.93 list drive on schedule task 1
D:\>NET USE
New connections will not be remembered.
There are no entries in the list.
D:\>Echo Wed 02/06/2013 18:31:52.98 map drive on schedule task 1
Wed 02/06/2013 18:31:52.98 map drive on schedule task 1
D:\>NET USE Z: \\127.0.0.1\Share /PERSISTENT:NO
The command completed successfully.
D:\>ping 127.0.0.1 -n 100 1>NUL
D:\>Echo Wed 02/06/2013 18:33:32.07 remove drive on schedule task 1
Wed 02/06/2013 18:33:32.07 remove drive on schedule task 1
D:\>NET USE Z: /DELETE
Z: was deleted successfully.
Schedule Task 2
d:\>Echo Wed 02/06/2013 18:32:22.54 list drive on schedule task 2
Wed 02/06/2013 18:32:22.54 list drive on schedule task 2
d:\>NET USE
New connections will not be remembered.
There are no entries in the list.
Output on windows 2008
Schedule task1
C:\Windows\system32>Echo Wed 02/06/2013 18:17:52.13 list drive on schedule task 1
Wed 02/06/2013 18:17:52.13 list drive on schedule task 1
C:\Windows\system32>NET USE
New connections will not be remembered.
There are no entries in the list.
C:\Windows\system32>Echo Wed 02/06/2013 18:17:52.16 map drive on schedule task 1
Wed 02/06/2013 18:17:52.16 map drive on schedule task 1
C:\Windows\system32>NET USE Z: \\127.0.0.1\Share /PERSISTENT:NO
The command completed successfully.
C:\Windows\system32>ping 127.0.0.1 -n 100 1>NUL
C:\Windows\system32>Echo Wed 02/06/2013 18:19:32.59 remove drive on schedule task 1
Wed 02/06/2013 18:19:32.59 remove drive on schedule task 1
C:\Windows\system32>NET USE Z: /DELETE
Z: was deleted successfully.
Schedule task2
C:\Windows\system32>Echo Wed 02/06/2013 18:18:07.69 list drive on schedule task 2
Wed 02/06/2013 18:18:07.69 list drive on schedule task 2
C:\Windows\system32>NET USE
New connections will not be remembered.
Status Local Remote Network
-------------------------------------------------------------------------------
OK Z: \\127.0.0.1\Share Microsoft Windows Network
The command completed successfully.
-
Wednesday, February 06, 2013 4:18 PM
The schedule task 2 are triggered while the schedule task 1 are running, In the windows 2003, the schedule task 2 could not list out any mapped drive. In the windows 2008, however, the schedule task 2 can list the network drive mapped by schedule task 1. The question is if there are any changes between windows 2003 and 2008, hope it can clarify.
Well I cant answer if this has changed or not between 2003 and 2008 however if both task 1 and task 2 are running under the same account it should be able to see the mapped drives as long as the login session for that user account is still active. When the task runs it runs with the user account as if it was logged in but without logging in if that makes sence therefore anything within that sessioin would be acessable if task 2 was also running in the same session.
My guess and this is a guess is that in 2003 each task ran in a diffrent session even for the same user account and in 2008 it runs within the same session if there is already an interactive login running. Dont quote me on that but would expain the diffrence.
8B17
-
Thursday, February 07, 2013 2:00 AMcould anyone confirm the behaviour change? and if there are any setting or policy to get the 2003 behaviour on 2008 environment?

