Path for Windows Services

pathwindows-server-2003windows-service

I've got a service that I need to start as a different user to 'Local System'

There is a user specific PATH I need to add to the default path in order for the service to work correctly.

The default PATH is A;B;C;
I've setup the users PATH X; so that when the user logs on interactively the effective PATH is A;B;C;X; This was done by setting HKEY_USERS\XXXXXXX\Environment\Path

All paths are on local hard drives.

When the service starts as the user I can watch it search for needed DLLs with ProcMon.
It is only searching A;B;C; when started as a service.

I've tried altering the service type from 0x10 to 0x110 which should allow desktop interaction to see if that would load the users environment, but it didn't seem to help.

Should Windows be loading the environment settings for a user when starting services?
Is there a workaround if this is the default behaviour?

Thanks

Best Answer

MS has a program that runs any program as a service. One of the parameters is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<name>\Parameters\AppDirectory, although this may only apply to these wrapped services.

Related Topic