?
Solved

VBSCRIPT Scheduling problem

Posted on 2003-03-11
7
Medium Priority
?
432 Views
Last Modified: 2008-01-16
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
Comment
Question by:texxavery
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 44

Accepted Solution

by:
CrazyOne earned 372 total points
ID: 8111969
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
 
LVL 44

Expert Comment

by:CrazyOne
ID: 8111977
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
 

Author Comment

by:texxavery
ID: 8112113
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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:texxavery
ID: 8112125
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
 
LVL 11

Assisted Solution

by:WATYF
WATYF earned 368 total points
ID: 8120175
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
 
LVL 11

Expert Comment

by:turn123
ID: 10112329
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

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sourc…
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question