473,770 Members | 3,710 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB.NET crashes when run from Windows scheduled tasks if user logged off

4 New Member
I have a VB.NET app that crashes when run from the Windows scheduled tasks, but runs fine when the run-as user is logged on. The app also runs fine from the scheduled jobs if the run as user is disconnected. The O/S is Windows Server 2003, the app is created with VB.NET 2003. The .NET framework is up todate with Windows releases. The APP opens connections to an SQL Server 2003 database and an ODBC sql connection to an iSeries database.

Unfortunatley the event viewer application message message is not very specific, please see below.

The scheduled task ending status is 0xc000013a, which implies "access denied". Apparently, the problem is due to not having permissions to access a needed object without the user being logged on.

But when I log on to attempt a debug, the app runs fine.

Is there a way to get a more specific message logged in the event view so that I have a clue as what the problem is?

We have tried running the task as an admin user, with the same results.
We added the specific user to Command.exe, still failed.
We added BATCH to the Command.exe object, still failed.

Thanks for your help
Weems


- - - Event View message
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: .NET Runtime version 1.1.4322.2379- AutoImagePOI.ex e - Common Language Runtime Debugging Services: Application has generated an exception that could not be handled.

Process id=0x158c (5516), Thread id=0x924 (2340).

Click OK to terminate the application.
Click CANCEL to debug the application..

MyBox .net: (version 1.1.4322.573)
Aug 10 '07 #1
7 9109
Plater
7,872 Recognized Expert Expert
Can you make your program run with the worker-process user credentials? Like the IUSER or something? Although if it didn't work as admin I'm not sure.

One thing I do know is that if the program is located on say computerA and you tell computerB to run that program located on ComputerA, you get access denied messages a-plenty.
I always have to run local copies for them to function.
Aug 10 '07 #2
whutto
4 New Member
Plater:
The program runs standalone with the user credentials in a command window and from the scheduled tasks as long as the user is logged on. But it will not run from the scheduled tasks if the user is logged off, even though the run-as user is the same..

Logging on seems to change the permissions available to the scheduled task, which I do not understand.

My problem is how to find out what specific object is generating the access denied messages.

Thanks
Weems
Aug 13 '07 #3
Plater
7,872 Recognized Expert Expert
Put in some try/catch blocks and have descriptive error messages, stacktrace and such?
Aug 13 '07 #4
TRScheel
638 Recognized Expert Contributor
My guess is that when it runs as system it is attempting to access something normally given a real user (my documents, etc) but not to the SYSTEM user. I would do as plater suggested above.
Aug 13 '07 #5
whutto
4 New Member
Thanks for the suggestions. I put in a subroutine that writes to a text file and used that at various points in the logic to pin down the problem.

The scheduled task cannot access the mapped network drive that has the image folders, but the program has permissions to do that when the user is logged on. I am working with SysAdmin to set the permissions to allow this to process.

Line 131 referenced in the message is
Dim finfo() As IO.DirectoryInf o = di.GetDirectori es()
which attempts to access the network drive to get the path information.

Thanks again
Weems

The actual error message text is:
System.IO.Direc toryNotFoundExc eption: Could not find a part of the path "L:\ImageArchiv e\ArchiveForms\ ".
at System.IO.__Err or.WinIOError(I nt32 errorCode, String str)
at System.IO.Direc tory.InternalGe tFileDirectoryN ames(String fullPath, String userPath, Boolean file)
at System.IO.Direc toryInfo.GetDir ectories(String searchPattern)
at System.IO.Direc toryInfo.GetDir ectories()
at AutoImagePOI.Mo dule1.Main(Stri ng[] sArgs) in C:\Documents and Settings\HP_Adm inistrator\My Documents\Visua l Studio Projects\AutoIm agePOI\AutoImag e.vb:line 131
Aug 13 '07 #6
TRScheel
638 Recognized Expert Contributor
Thanks for the suggestions. I put in a subroutine that writes to a text file and used that at various points in the logic to pin down the problem.

The scheduled task cannot access the mapped network drive that has the image folders, but the program has permissions to do that when the user is logged on. I am working with SysAdmin to set the permissions to allow this to process.

Line 131 referenced in the message is
Dim finfo() As IO.DirectoryInf o = di.GetDirectori es()
which attempts to access the network drive to get the path information.

Thanks again
Weems

The actual error message text is:
System.IO.Direc toryNotFoundExc eption: Could not find a part of the path "L:\ImageArchiv e\ArchiveForms\ ".
at System.IO.__Err or.WinIOError(I nt32 errorCode, String str)
at System.IO.Direc tory.InternalGe tFileDirectoryN ames(String fullPath, String userPath, Boolean file)
at System.IO.Direc toryInfo.GetDir ectories(String searchPattern)
at System.IO.Direc toryInfo.GetDir ectories()
at AutoImagePOI.Mo dule1.Main(Stri ng[] sArgs) in C:\Documents and Settings\HP_Adm inistrator\My Documents\Visua l Studio Projects\AutoIm agePOI\AutoImag e.vb:line 131
If probably doesnt exist for that user. I would do create a process object that ran 'net use L <location>' before trying to connect to it with a DirectoryInfo. There might be a way to do that in code though and not through the command line.
Aug 14 '07 #7
whutto
4 New Member
Worked with the sysadmin and we came up with a workaround. Rather than using a mapped network drive, ie
L:\ImageArchive \ArchiveForms\

we are using the network IP address to access the folders, ie:
\\192.168.1.22\ e\ImageArchive\ ArchiveForms\

I am surprised that there isn't a security issue with this, but it works without any problems.

The thing to remember in running a program from the Windows scheduled tasks is that the user's logon scripts have not executed and have not set up the mapped drives, desktop, etc for that specific user.

Thanks for everyone's input.
Weems
Aug 14 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
14705
by: Colin Steadman | last post by:
We have a number of scheduled tasks on our IIS server that run daily at some point during the early morning. These tasks run as a specific user that has the correct permissions to perform whatever task (processing SQL so I'm told) I have been asked if I can setup a page within ASP that a user could logon to with their own credentials (this I can do). And once logged on be presented with a list of scheduled tasks which they can then...
11
4087
by: Codemonkey | last post by:
Hi, I am writing an App in .Net that involves some scheduling of tasks. I was wondering if anybody has come accross any components or examples of how to implement a schedule manager like the one in the Task Scheduler for Windows? Basically I'm after something that'll allow me to specify a "recurring" or "once off" schedule with advanced options like "the first monday in the month" etc.
0
4236
by: Satish | last post by:
Scheduled Tasks (.Net ) does not run when server is logged off (Windows 2003): I have a .net executable (command line exe) which performs certain business operations. I can run the program (scheduled or manually) without a problem if I am logged in. But when i log off and and set it up as a scheduled task using the Task Scheduler, I receive the following error. Event Type: Error
6
8596
by: Krish | last post by:
I want to develop and application that run periodically in the server machine. Now Should I go for a windows service or just create a Console application and schedule it using the windows Task Scheduler. What are the advantages and disadvantages of each approach. Thanks Krish
3
3442
by: kj7ny | last post by:
How can I access and manipulate Scheduled Tasks in Windows using Python? I have a Windows XP workstation running Python 2.4.4 using the win32all modules to control the windows services on multiple Windows 2003 servers. It works great. However, I also need to remotely collect the settings for the scheduled tasks (on those same Windows 2003 servers) and then manipulate those task settings.
0
8182
by: kkkanoor | last post by:
I am trying to schedule tasks in Windows from my C# program. The tasks get listed in Windows Schedule Tasks list, but it is not getting invoked. It seems I need to give the user name and password to start the task OR I have to set the property "RunOnlyIfLoggedOn" to true. But I don't know how to do this. Please help. The following code I used is posted in one of the forums. Please find the code below. --- CODE --- simply use...
5
2653
by: rcook349 | last post by:
I want to run a piece of C# code at midnight every night that opens a file, changes something in it, and saves it. Would this be a Console Application set up as some sort of job? Would it be a Windows Service? Thanks, Ron
1
4325
by: oct08 | last post by:
Hi all, I'm trying to trouble shoot an issue where I am running an Access/VBA app, which grabs some data and puts it into a few text files. It usually takes 10 minutes to run (though after even a minute, some of the texts should be written). When I run the task manually, it acts exactly as it should. When I go to run the task automatically, it will work, but only if I am logged in. If I am logged off, nothing gets updated, and the...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10008
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
8891
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
7420
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
6682
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
5313
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...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.