Map a network space to a Windows Drive in a scheduled job (script)?

1

1

I need to map to a network space a mapped drive such as S: for some other jobs. My box is Windows Server 2008. In Windows Server 2008, I can create a scheduled task with a bat job, and I can specify it runs when Windows is reboot or Log on without specified user. It like a service with local system. The bat contains net cmd to map the drive:

net use S: \\netdrive1\space1 pwd /user:oneUser

Then I reboot the box. It looks like that the scheduled job did run. I can check from the Task Scheduler job's history. However, the S: drive cannot be mapped. If I just run the bat from the command line. It works fine. It seems that I have to log on the box to make the mapped drive. Not sure if it is possible to let Windows to run the job as local system when it reboots to make the drive available?

For my case, the network drive is at a Unix box.

As I mentioned above, I have some other dependency scheduled jobs under Windows local system. Therefore, I have to make the network space available without any user log on.

David.Chu.ca

Posted 2010-09-01T20:10:16.623

Reputation: 2 967

Server admin stuff may be better asked at serverfault.com – JNK – 2010-09-01T20:16:54.517

Answers

1

From a question asked on StackOverflow:

You'll either need to modify the service, or wrap it inside a helper process: apart from session/drive access issues, persistent drive mappings are only restored on an interactive logon, which services typically don't perform.

The referenced post goes into some detail so you may want to have a look.

If your other jobs are also batch files, they'll need to perform the necessary mapping themselves.

BillP3rd

Posted 2010-09-01T20:10:16.623

Reputation: 5 353