Run as a service

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Run as a service

Post by kpassaur » Thu May 28, 2009 9:10 pm

I have a compiled script that works fine. I would like it to "Run as a Service" by this I mean have it automatically run at startup and stay running if the user logs off.

I have followed the instructions for running a program as a service from Microsoft using Sryany.exe and Instsrv.exe.

It is now loaded under services, when I go into Task Manager I can see it running under services, but the program no longer does anything. One thing I rean is that it may not run unless interact with desktop is checked if an Icon is to be displayed in the systray. So I recompiled and tried it again, still nothing. I can start and stop it under services, see it appear and then be removed but the program itself does nothing.

I could understand it failing if some of the dlls it uses are not found on start up. But this is not the case as the first part of the script just moves a file and that portion does not work.

Has anyone loaded a compiled script as a service and had it run properly?

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

Interactive Services not available under Vista

Post by gdyvig » Fri May 29, 2009 12:55 am

Hi kpassaur,

I have written a Macro Scheduler compiled script that runs as a Srvany service on Windows XP and on Windows Server 2003. For the service to interact with the desktop in any way you must create it as "interactive service". This option is not available under Vista, so you will not be able to do what you want.

Because interactive services will become a thing of the past I decided not to use an interactive service and used a workaround. I wrote a non-interactive service that runs even when all users are logged off and restricted it to things like monitoring processes and sending email alerts. Another compiled script was installed in the user's startup folder (or the all users folder if you want it to run for any user, don't know if this works for Vista's default folder). This compiled script runs as a process and can interact with the user's desktop for the duration of the user's session.

The non-desktop service can run under an account with elevated privileges and can communicate with the desktop process which runs under the likely reduced privileges of the logged on user.



Gale

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Run as a service

Post by kpassaur » Fri May 29, 2009 9:49 am

Gale,

Thanks for your response. It would explain Vista. What I ended up doing and it seems to be working fine is I used a program called "Launcher Service" which is freeware and available at:

Product Details - http://emutastic.emulation64.com/netosoft/projects.htm

Download - http://emutastic.emulation64.com/netoso ... rv_0.2.zip

It saved a ton of hassel as I was writing a script to modify the registry entries to load it as a service and this has a simple ini to edit and a bat file which loads everything and another which will remove everything.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri May 29, 2009 3:40 pm

Did you check out their Forum :lol:

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri May 29, 2009 9:59 pm

Where does everyone get all this free time? A very unique forum, indeed! shock:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts