Windows 2003 Services Will Not Run Program

I have created a simple VB script that will email me to let me know when a service has stopped on my server. Anyway when I double click this script on my desktop is works perfectly. Yet, when I setip a service on my workstation or server to run this script when the services stops / fails it never sends run the script?

What am I doing wrong???
LVL 21
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I suppose you created a VB Script i.e. my.vbs. On the service manager console, you should define  "%windir%\system32\cscript.exe" as the program and "drive:\path\to\my.vbs" (in double quotes) as the command line parameter. Alternatively, you can point to a bat file which in turn contains:

"%windir%\system32\cscript.exe" "drive:\path\to\my.vbs"

In either case, make sure "SYSTEM" has read access to your script.
compdigit44Author Commented:
I tried what you suggest and my script still does not send out an email alert when I manually stop the servicse yet it work fine when I double click the script
I suggest you verify that system account has permissions to send e-mails (i.e. if you use NTLM authentication in CDO). A log entry in a text file will help you pin-point the problem. Also, I'm not very sure that the event is triggered when you manually stop the service. Try to crash the service (i.e. kill its process with taskkill or task manager) and see if it works. Are there any relevant entries in the System Event Log (under Service Control Manager)?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
compdigit44Author Commented:
You were right.. the service has to be "killed" in order for the script to runn.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.