VBSCRIPT Scheduling problem
Posted on 2003-03-11
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)
MyMnth = Month(currentdate)
MyDay = Day(currentdate)
MyYear = Right(Year(currentdate),2)
If Len(myDay) = 1 Then
MyDay = "0" & myDay
If Len(myMnth) = 1 Then
MyMnth = "0" & myMnth
Set fso = CreateObject("Scripting.FileSystemObject")
Set WshNetwork = WScript.CreateObject("WScript.Network")
on error resume next
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