• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 442
  • Last Modified:

VBSCRIPT Scheduling problem

I have modified one of my scripts used to pull files from multiple servers to a centralized reporting server to use all vbscript with windows scripting host. I can run the file manually just fine but cannot get it to run from windows scheduler on windows 2000. I have tried adding every account under the sun to the task turned on all rights and it still does nto work. Here is a little sample of the code with private information removed.

'Creates Date - 1 information

CurrentDate = Now()-1

'Creates number of days in month and last day of month

daysInMonth = Day(DateSerial(Year(now), Month(now)+1, 0) )
lastDayOfThisMonth = DateSerial(Year(now), Month(now)+1, 0)

Dim MyMnth
Dim MyDay
Dim MyYear

MyMnth = Month(currentdate)
MyDay  = Day(currentdate)
MyYear = Right(Year(currentdate),2)

If Len(myDay) = 1 Then
 MyDay = "0" & myDay
End If

If Len(myMnth) = 1 Then
 MyMnth = "0" & myMnth
End If

'Scripts

Set fso = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
on error resume next

'servername

WshNetwork.MapNetworkDrive "j:", "\\000.000.000.000\weblogs$", false, "user", "password"
fso.CopyFile "j:\servername\w3svc1\ex" & Myyear & MyMnth & MyDay & ".log", "d:\archive\servername\"
WshNetwork.RemoveNetworkDrive "j:", True, True
0
texxavery
Asked:
texxavery
2 Solutions
 
CrazyOneCommented:
Did you enter the password to the for the user that is logged in when the task is suppose to run?


The Crazy One
0
 
CrazyOneCommented:
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/prodtechnol/windows2000serv/deploy/prodspecs/win2ksvc.asp

Task Scheduler - enables a program to run at a designated time. This service enables you to perform automated tasks on a chosen computer. The Task Scheduler monitors whatever criteria you choose and carries out the task when the criteria for it have been met. For example, you can have the computer run ScanDisk at 7:00 P.M. every Sunday.

Task Scheduler is automatically installed with Windows 2000 and is started each time the operating system is started. It can be run from Windows 2000 (by means of the Task Scheduler graphical user interface [GUI]) or through the Task Scheduler API. If Task Scheduler is disabled, jobs that are scheduled to run won't run at their designated time or interval. Scheduled Tasks using local accounts won't run without a password.

Any task that is using a local account (non-domain account) as the account under which the scheduled task is to run requires a password. If the local account doesn't have a password one needs to be created for that account, and then the task needs to be scheduled using that account name and password. You can create a password for an account by going to Control Panel, User Accounts, Create a Password. Any valid password is acceptable, but it cannot be a blank password.
0
 
texxaveryAuthor Commented:
The script has username, pasword etc in it and runs without any problems when doubled clicked. I took all the code out of the script except for the part that maps the drive and it works by double clicking but doesn't work when scheduled.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
texxaveryAuthor Commented:
The script has username, pasword etc in it and runs without any problems when doubled clicked. I took all the code out of the script except for the part that maps the drive and it works by double clicking but doesn't work when scheduled.
0
 
WATYFCommented:
I think we're talking about two different passwords here. (I may be entirely wrong though). You are accessing a file on a secure server, so you have included a password in the script, but you also need to assign a username and a password to the Task itself. (forgive me if you've already done this.)

Right click on the taks and click "Properties". Then set "Run as:" to the domain/username and password that you are using to access the script. The domain/username and password that you use for the Task only has to have rights to the script itself... it doesn't need to be the same user that you have setup in the script to access the reporting server.

I'm sorry if you've already covered this... I just wasn't clear from your posts that you had... just thought I'd mention it.


WATYF
0
 
turn123Commented:
texxavery,
No comment has been added lately (308 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: split points between CrazyOne http:#8111969 and WATYF http:#8120175

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

turn123
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now