I have an application that I have been running in a user (administrator) account and am now trying to run it as a service.

Right now the issue is that when I run the application as a service it has trouble finding some files located relative to its self. The other issue is that it seems to not want to communicate on a socket it is using.

The information I have to start with is that the app is running as SYSTEM when it starts as a service.

I'm looking for a way to explicitly specify its path and security context to start with. I have already set the firewall rules to allow any connection for incoming and out going traffic for this app across all profiles (domain, private, public).


It sounds like the application isn't actually built to run as a service and you're trying to "force" it. You must be using something like "SRVANY" to get the application running as a service to begin with.

I'd create an account for the service to run under, give that account rights to the appropriate files / folders, and run the service under that account, for starts. You can set the account that the service runs under on the "Log On" tab of the service properties.

There is no mechanism either natively in the Service Control Manager or using SRVANY (or any third-party SRVANY type utility that I'm aware of) to set the current directory prior to starting the service. You might be able to "wrap" the service in a CMD script and execute that script (i.e. set the image started by SRVANY to "%SystemRoot%\System32\cmd.exe", give it the argument "/c name-and-path-of-script.cmd", and in that script change the directory and execute the intended program) but I wouldn't give that a high chance of success.

  • my issue was an issue with the path that the application started in. – QueueHammer Sep 10 '09 at 15:15

Assuming that you are using SRVANY, you can set the starting path with HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<name>\Parameters\AppDirectory. (Or, at least you could under 2003.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.