473,796 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("St arting") 'when it fails, nothing is written
to the log
Pth =
System.IO.Path. GetDirectoryNam e(System.Reflec tion.Assembly.G etExecutingAsse m
bly.Location) + "\"
'OrigTemplate is just a dot with a bookmark named bmark in it
FileCopy(Pth + "OrigTemplate.d ot", Pth + "NewTemplate.do t")
Dim oWord As Word.Applicatio n
Dim oDoc As Word.Document
Dim oTemp As Word.Template
Dim oRange As Word.Range
Dim addr As String

oWord = CreateObject("W ord.Application ")
oWord.Visible = False
oDoc = oWord.Documents .Add(Pth + "NewTemplate.do t")
oTemp = oWord.ActiveDoc ument.AttachedT emplate
oRange = oDoc.Bookmarks. Item("bmark").R ange

Dim i As Integer, cd As String, dr as datarow
PortAddDA.Fill( PortAddDS1)
For Each dr In PortAddDS1.Tabl es("Addresses") .Rows
addr = ""
cd = dr.Item("Code") )
oTemp.AutoTextE ntries.Add(cd, oRange)
addr += dr.Item("Client ") + vbCrLf + dr.Item("Addres s")
oTemp.AutoTextE ntries.Item(cd) .Value = addr
Next

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

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

GC.Collect()
Me.Close()
Nov 20 '05 #1
7 1734
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******** ******@cpmsftng xa06.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******** ******@cpmsftng xa06.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******** ******@cpmsftng xa06.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
4580
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, etc. All my command scripts utilizing this console application work fine when they are executed interactively. However, if they are executed via a scheduled task, they do not run. Or more precisely, the script seems to execute at the...
6
8252
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, but I need to launch the add tasks wizard inside the folder. Does anyone have any ideas of how to do this? I can't find anything in the MSDN regarding this. All it mentions is the Task Scheduler API and I can't seem to find it in there either. Did...
3
22958
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 manage scheduled tasks on different servers. So, how can I add scheduled task to local machine or remote servers programmatically? Thanks.
0
235
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 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...
1
1846
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). In the event a user runs the task manually I need to verify their identity for logging purposes. So I have two questions: 1. Is there a way to tell if a scheduled task was run because of its scheduled time or if a user manually initiated it?...
0
2977
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. We migrated a database from SQL 2000 to 2005 which is on a different box. I changed the connection in the vb script to use the new sql server. The original connection to SQL 2000 used the 'sa' account coded into the connection string , which...
1
7492
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. We migrated a database from SQL 2000 to 2005 which is on a different box. I changed the connection in the vb script to use the new sql server. The original connection to SQL 2000 used the 'sa' account coded into the connection string , which...
0
1983
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 folder(ie. Scheduled Taks folder) is opened,but what I want is to open the Add Scheduled Task wizard in it.Is there any run command to do that? Also if I am able to open the Scheduled Task wizard like this is there any way by which I can...
9
3781
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 directory. This exe does the following 3 things: 1.) Using the VB Interaction SaveSetting() method, it programmatically updates the system registry under the HKEY_CURRENT_USER\SOFTWARE key and saves a directory location used by a PDF driver (so that...
0
9683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10176
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10013
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9054
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7550
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6792
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3733
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.