Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching external program from Service 1

Status
Not open for further replies.

RealQuiet

Programmer
Feb 11, 2001
54
US
I have a Windows service that monitors a directory for a file. When the file arrives, I need to launch Access and do some things with that file through a macro.

I am successful at doing this from a command line, but something goes wrong when I incorporate this into the service.

I am using the Shell Command to launch the program, and I see that, sure enough, MSACCESS.EXE appears in my processes list, but nothing happens. I am assuming it's due to the user interface-less nature of services, but I don't know how to get around this. Any help would be appreciated.
 
Sounds like a permissions problem. Check what account your service is running under, and make sure it has enough authority to run MS Access.

Chip H.
 
I am running the service as an administrator. Is there some .Net framework security setting that is stopping me from launching another program? I tried using the System.Diagnostics.Process class to launch the app, and also tried running this code from a regular .exe. I got the same results with all of these.
 
Actually it does work from a regular windows application, just not from the service. Have you had any problems launching programs from a service?
 
Ok, I figured out that I have to run the process as LocalSystem with the Interact with desktop option checked. The program launches fine from my service now. Now my problem is that LocalSystem doesn't have rights to the remote machine it is supposed to be monitoring. Has anyone done this?
 
The only solution I have been able to come up with is this. Create one service that monitors the remote directory and runs under a domain account with access to the remote machine. This will move the file to the local machine. Create another service that runs under the LocalSystem account and can interact with desktop to monitor the local directory that is fed by the other service. If anyone has any better solutions, I would definitely love to hear them. Seems like overkill to create 2 services to perform my fairly simple task.
 
Hi,
I've a similer kind of problem. I've to execute a vb script file at the web server using WScript.Exe. My script is a database script which does not contain any UI. I am using System.diagnostics.Process.Start("WScript.Exe","C:\InetPub\ method. This command works fine in a wndows application. I've this code in a Web Service in my project. My ASPNET account is an Admin account and it has full privileges on both of the files.
Somewhere I read that making use of a Windows Service can solve this problem. Please tell me how to create a Windows Service at the Web Server.

Any help will be appeciated
Thanks in advance

Adasoft
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top