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 the pdf driver does not prompt for a location).
2.) opens up an instance of a local MSAccess database (i.e., set objAccess = New Access.Application(c:\mydatabase.mdb))
3.) Uses the DoCmd.OpenReport method to create a physical .pdf report to the location specified above in step 1. Then the report is emailed out to a group of users.
When I'm logged on to the Windows 2000 server as my user i.d. and I double click the .exe file, everything works perfectly.
However, I'm running into problems when trying to automate this and kick off the .exe file with a Windows scheduled task. If I run the scheduled task as my i.d., I do not get past step 2 above as it keeps giving me the following error:
"System.UnauthorizedAccessException: Access is denied." It appears that my userID cannot create a new instance of MSAccess but only when run through the scheduled task.
If I run the scheduled task as NT AUTHORITY\SYSTEM, I get an error message on step 3 above with the following error message:
"There was a problem retrieving printer information for the Win2PDF on PDFFILE:. The object may have been sent to a printer that is unavailable."
In this case it appears that I cannot save registry settings as the NT AUTHORITY\SYSTEM user for the pdf printer.
So my questions are first, does anyone know why I cannot create an instance of MSAccess when using the scheduled task. And second, why can't I save registry settings when I run the .exe through a scheduled task as the NT AUTHORITY\SYSTEM user?
Thanks in advance,
John
9 3712
Most of your questions come down to permissions. Your question is confusing in that it appears to associate saving a db file with installing db software. The install works with an account that suggest using windows authentication without impersonation.
Most of your questions come down to permissions. Your question is confusing in that it appears to associate saving a db file with installing db software. The install works with an account that suggest using windows authentication without impersonation.
Yes, it does come down to permissions which is what I'm trying to figure out. Let's start simpler:
I'm an admin on the server. If the .exe works fine and can open instances of MSAccess when I double click it, why does it fail to instantiate MSAccess when a scheduled task runs the executable as the NT AUTHORITY\system user? What am I missing here?
Thanks,
John
Yes, it does come down to permissions which is what I'm trying to figure out. Let's start simpler:
I'm an admin on the server. If the .exe works fine and can open instances of MSAccess when I double click it, why does it fail to instantiate MSAccess when a scheduled task runs the executable as the NT AUTHORITY\system user? What am I missing here?
Thanks,
John
You have hit the nail on the head - Access is run under your admin account but not the anonymous account. Are you planning to automate this task on any other machines/servers?
You have hit the nail on the head - Access is run under your admin account but not the anonymous account. Are you planning to automate this task on any other machines/servers?
I apologize, my previous reply was a bit confusing after I reread it. First to answer your question, I am planning to automate this task with the scheduled task only on the server that the exe is currently sitting. It will not be deployed anywhere else.
But I think I might have miscommunicated what's actually going on here. Let me take a step back and reconfirm what's going on:
If I double click the .exe everything works fine.
If the scheduled task executes the .exe as my user ID I get the "Access is Denied" error (can't instantiate MSAccess).
If the scheduled task executes the .exe as the NT AUTHORITY\SYSTEM user, the application can instantiate MSAccess, but I get other errors mentioned in my original post about reading registry settings. Therefore, I'd like to solve this problem if possible by executing the scheduled task as my i.d. and get past this inability to instantiate MSAccess.
Thanks,
John
NP. This is why I mentioned impersonation in my first post, I believe now that this may be the key to your problems. An example might help: User Impersonation in .Net.
NP. This is why I mentioned impersonation in my first post, I believe now that this may be the key to your problems. An example might help: User Impersonation in .Net.
Thanks, kenobewan. I'll give this a whirl later tonight when I get some time and reply back with my results. It does appear from first glance that this might be the issue.
Thanks again.
Well the impersonation code didn't seem to work. After referencing the ImpersUser dll in my project, I tried running the 1 line of code to impersonate as the NT AUTHORITY\SYSTEM user. No errors were thrown so i'm assuming that the impersonation as NT AUTHORITY\SYSTEM went through ok, but I still could not open up the access database. I'm really stumped here.
You are having no joy because, not an insult, you are new to this. To progress with this prob you'll need to learn much more about .net.
This is time consuming in the short term, but you'll benefit in the long run if you face other situations like this. The alternative is to hand this over to a developer.
The reason I am saying this is not be unkind, but we are starting to go around in circles here. I believe that there is enough info in my posts to solve this problem.
You are having no joy because, not an insult, you are new to this. To progress with this prob you'll need to learn much more about .net.
This is time consuming in the short term, but you'll benefit in the long run if you face other situations like this. The alternative is to hand this over to a developer.
The reason I am saying this is not be unkind, but we are starting to go around in circles here. I believe that there is enough info in my posts to solve this problem.
No offense taken, however I am a developer and know how to write .net exe modules and have been doing so for several years. What I'm not familiar with are account permissions because I'm not a network administrator. And don't take this the wrong way because I appreciate your help, but other than the impersonation class that didn't fix the issue, you didn't suggest anything that I haven't already tried. So I think I need to present my issue to another message group. There has to be someone who has faced this same exact problem before. Thanks again.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Christina |
last post by:
Dear All,
How can I pop up the windows task scheduler inside of my .net application?
Such as I have a button called Schedule Now, after clicking it, the Add
Scheduled Task window will pop up,...
|
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,...
|
by: nkunapa |
last post by:
Hi:
I am looking for any ideas/comments/suggestions on how a Windows
Service kind of functionality can be acheived from a web application
which which will run under IIS or for that matter any...
|
by: helpful sql |
last post by:
Hi all,
I want to write a .Net solution that I would like to run as a scheduled
task in windows. I am not going to need any user interface. What I don't
understand is what kind of project I need...
|
by: arun.hallan |
last post by:
Hi,
I want to run a webservice method every night at a specified time, say
10pm.
The current way i thought of doing this is to have a windows service
and a timer which checks the time every...
|
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.
...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |