473,382 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Scheduled task failing


I have a pretty straightforward app that's designed to take entries from a
database and create a Word template containing AutoText entries using those
entries. A basic outline of the code is below.

If I run it manually then everything works fine. But the idea is that it
runs overnight and....

If I set it up as a scheduled task (Win 2K server, running as a user that
has full domain admin rights) then it works the first time, but second and
later I get a "Task could not start" error and the following in the task
scheduler log.

"The attempt to log on to the account associated with the task failed,
therefore, the task did not run.
The specific error is:
0x80070569: Logon failure: the user has not been granted the requested logon
type at this computer.
Verify that the task's Run-as name and password are valid and try again."

If I then set the job up again (i.e. reinput the path to the exe and enter
the user name and password), then the same thing happens. First time fine,
next time clunk. I figure that the rights issue error message must be wrong
otherwise how could it run successfully the first time.

To try and separate what exactly was going wrong I also took all of my code
and put it into a subroutine, changed the load code to just enable a timer,
and called my main subroutine from the timer elapsed event. Same thing
happens.

I appreciate that this may not be the best newsgroup for this question, but
nobody on win2000.general had a clue.

Any ideas?
.....and the code which is in the load event of my one form (simplified
version, but containing everything that I'm doing)....

Dim Pth As String
AddressEventLog.WriteEntry("Starting") 'when it fails, nothing is written
to the log
Pth =
System.IO.Path.GetDirectoryName(System.Reflection. Assembly.GetExecutingAssem
bly.Location) + "\"
'OrigTemplate is just a dot with a bookmark named bmark in it
FileCopy(Pth + "OrigTemplate.dot", Pth + "NewTemplate.dot")
Dim oWord As Word.Application
Dim oDoc As Word.Document
Dim oTemp As Word.Template
Dim oRange As Word.Range
Dim addr As String

oWord = CreateObject("Word.Application")
oWord.Visible = False
oDoc = oWord.Documents.Add(Pth + "NewTemplate.dot")
oTemp = oWord.ActiveDocument.AttachedTemplate
oRange = oDoc.Bookmarks.Item("bmark").Range

Dim i As Integer, cd As String, dr as datarow
PortAddDA.Fill(PortAddDS1)
For Each dr In PortAddDS1.Tables("Addresses").Rows
addr = ""
cd = dr.Item("Code"))
oTemp.AutoTextEntries.Add(cd, oRange)
addr += dr.Item("Client") + vbCrLf + dr.Item("Address")
oTemp.AutoTextEntries.Item(cd).Value = addr
Next

oRange = Nothing
oTemp = Nothing
CType(oDoc, Word._Document).Close()
oDoc = Nothing
CType(oWord, Word._Application).Quit()
oWord = Nothing

FileCopy(Pth + "NewTemplate.dot",<Target location(s) on network>)

GC.Collect()
Me.Close()
Nov 20 '05 #1
7 1691
Hi ,
One thing I can suggest is that you should copy the msconfig.exe utility
from windows xp machine to this 2000 server and drop it in the system32
folder. then run msconfig from start->run and choose the diagnostic startup
mode and then restart it and run the program and see if it works fine. It
it does thatn probably some start up item on the server maybe the cause for
the problem. You can look at the start up items by running msconfig and
looking at the start up tab, then basically you will have to narrow down
and find out which one causes the problem.

Thanks
Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks

Nov 20 '05 #2
Hi ,
One thing I can suggest is that you should copy the msconfig.exe utility
from windows xp machine to this 2000 server and drop it in the system32
folder. then run msconfig from start->run and choose the diagnostic startup
mode and then restart it and run the program and see if it works fine. It
it does thatn probably some start up item on the server maybe the cause for
the problem. You can look at the start up items by running msconfig and
looking at the start up tab, then basically you will have to narrow down
and find out which one causes the problem.

Thanks
Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks

Nov 20 '05 #3
Thanks for the idea, but I don't see how startup items can be causing
problems. If they were then surely the scheduled task wouldn't work the
first time. Could you expand on how you think a startup item could be
breaking the task?
"Anand Balasubramanian(MSFT)" <an****@online.microsoft.com> wrote in message
news:ps**************@cpmsftngxa06.phx.gbl...
Hi ,
One thing I can suggest is that you should copy the msconfig.exe utility
from windows xp machine to this 2000 server and drop it in the system32
folder. then run msconfig from start->run and choose the diagnostic startup mode and then restart it and run the program and see if it works fine. It
it does thatn probably some start up item on the server maybe the cause for the problem. You can look at the start up items by running msconfig and
looking at the start up tab, then basically you will have to narrow down
and find out which one causes the problem.

Thanks
Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights. Please reply to newsgroups only. Thanks

Nov 20 '05 #4
Thanks for the idea, but I don't see how startup items can be causing
problems. If they were then surely the scheduled task wouldn't work the
first time. Could you expand on how you think a startup item could be
breaking the task?
"Anand Balasubramanian(MSFT)" <an****@online.microsoft.com> wrote in message
news:ps**************@cpmsftngxa06.phx.gbl...
Hi ,
One thing I can suggest is that you should copy the msconfig.exe utility
from windows xp machine to this 2000 server and drop it in the system32
folder. then run msconfig from start->run and choose the diagnostic startup mode and then restart it and run the program and see if it works fine. It
it does thatn probably some start up item on the server maybe the cause for the problem. You can look at the start up items by running msconfig and
looking at the start up tab, then basically you will have to narrow down
and find out which one causes the problem.

Thanks
Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights. Please reply to newsgroups only. Thanks

Nov 20 '05 #5
Hi ,
One reason I can think of is, the task may be doing something after a
specific period of time and hence when your program runs the first time, it
may work. Anyway the start-up item theory is just one I could think of. I
have seen this happen a few times in the past. So you might just want to
give it a try.

Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks

Nov 20 '05 #6
Hi ,
One reason I can think of is, the task may be doing something after a
specific period of time and hence when your program runs the first time, it
may work. Anyway the start-up item theory is just one I could think of. I
have seen this happen a few times in the past. So you might just want to
give it a try.

Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks

Nov 20 '05 #7
Thanks again, but it just doesn't make any sense to me to link it to startup
items. If I schedule the job, it runs. I reschedule (and tell it the app
again) one minute later, it works. If I schedule (successfully) and the
reschedule one minute later (without telling it the app again) it fails.

I can't see how that can possibly link to startup stuff.
"Anand Balasubramanian(MSFT)" <an****@online.microsoft.com> wrote in message
news:F3**************@cpmsftngxa06.phx.gbl...
Hi ,
One reason I can think of is, the task may be doing something after a
specific period of time and hence when your program runs the first time, it may work. Anyway the start-up item theory is just one I could think of. I
have seen this happen a few times in the past. So you might just want to
give it a try.

Anand Balasubramanian
Microsoft, Visual Basic .NET

This posting is provided "AS IS" with no warranties, and confers no rights. Please reply to newsgroups only. Thanks

Nov 20 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: A. Lovhaug | last post by:
I have a console application built in the .NET Framework. This application basically executes an XCopy based on parameters that I pass to it. I use it for creating scripts for backing up folders,...
6
by: John Bowman | last post by:
Hi, I have a C# app that needs to launch the "Add Scheduled Tasks" wizard found in the control panel "Scheduled Tasks" applet. I realize that this "applet" really just opens the tasks folder,...
3
by: Lenn | last post by:
Hi, I developed a console .exe application which is going to run on scheduled basis, it will be scheduled to run in Windows Scheduled tasks. Client wants some kind of utility that would help them...
0
by: Rob Oldfield | last post by:
I have a pretty straightforward app that's designed to take entries from a database and create a Word template containing AutoText entries using those entries. A basic outline of the code is...
1
by: satelite | last post by:
Hello, I am writing an exe that is intended to be run via a scheduled task. However, I also need the flexibility to have users run the scheduled task manually (right click task and select run). ...
0
by: Myster Edd | last post by:
I have a strange problem that I think deals with security on SQL 2005. I have a scheduled task that runs on a Windows 2000 machine. It calls a vb script which creates a connection to SQL Server. ...
1
by: Myster Edd | last post by:
I have a strange problem that I think deals with security on SQL 2005. I have a scheduled task that runs on a Windows 2000 machine. It calls a vb script which creates a connection to SQL Server. ...
0
by: Paulson | last post by:
Dear Freinds I want to make a program that acts as a reminder for the users.I need to open up the Scheduled task wizard programmatically.If you type Tasks in the run command the Tasks...
9
by: jdaelhousen | last post by:
I have a bit of a problem I'm hoping someone can shed some light on... I have a VB.Net console application written in VS 2003 that produces a .exe file that now sits on a Windows 2000 server...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.