Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scheduled Task hangs when not logged into Windows 2003 Server

Status
Not open for further replies.

sweetiek08

Programmer
Feb 27, 2008
3
I am trying to run Microsoft Excel macros in a scheduled task on a Windows 2003 server. When I let the scheduled tasks run when I am logged in, they work. However, when I am not logged in, the task starts, but doesn't run (it displays "running" as the status, but nothing happens.) I have read that this can happen when network drives are not accessible, but I map the network drive I need in my VBA code:

Set WshNetwork = CreateObject("WScript.Network")
Set AllDrives = WshNetwork.EnumNetworkDrives()

AlreadyConnected = False
For i = 0 To AllDrives.Count - 1 Step 2
If AllDrives.Item(i) = "Y:" Then AlreadyConnected = True
Next

If AlreadyConnected = "False" Then
WshNetwork.MapNetworkDrive "Y:", "\\myserver\myshare"
End If


Any help is much appreciated!



Thank you for your help!
 
you have no credentials to map the drive as no one is logged in.

Either use a account in the mapping or trying adding the computer to a group with access to the server.
 
Thank you for your response. What is the best way to include account information in the mapping? Specifically I am concerned about password security.
 
Go to the properties of the task, and it's right there on the first page. The stronger the password, the better.

That's about all you can do with drive mapping security on your client.

Mike Fegan


Learn how to tweak YOUR box, and talk shop with other techies!
 
Thanks, I have had the password set on the scheduled task, but it has not been working. I thought using the account in the mapping meant I had to specify it somewhere else. The password and user the account is set up for is an administrator on the server, and has access to drives, but it is still not working when I'm not logged in.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top