This content has been marked as final. Show 2 replies
Top reasons why something runs (on Windows) from DOS prompt, but does not run using CFEXECUTE.
By default, services run under LOCAL\SYSTEM account. If the task requires some privileges not granted to this account, it will fail. You can change service's account using Startup Options for particular service. This is a very insecure option, however, many people do this, when no other options available. There are also third-party replacements for CFEXECUTE that can do this more securely.
2. User profile
A task may need to run in the context (profile) of a specific user in order to be successful. It means that user (see 1) must be logged in interactively: in the same way as you do when you press CTRL-ALT-DEL. The solution can be to run the service under the same account that is used to login in Windows. This might be unacceptable, since on server environment there might not be any interactive user at all. Many security elements in Windows are connected with user profiles: SSL certificates, encryption keys, etc. If the program you run uses some registry settings, and those settings are stored in a user profile, not in machine profile, such program will not run successfully, unless that profile is loaded and accessible to the service account. Good example is ODBC datasources setup: only machine datasources, in general, available to services. So, another solution is to make sure that all necessary stuff goes to the machine profile. So, you might try to re-install (or even manually correct the installation) the software accordingly.
If your task uses windows messages to communicate with other running tasks, all of them must be using the same desktop and window station. This applies to all messages, including DDE. This is unlikely your case. All tasks that were launched (explicitly or implicitly) by interactive user use default (visible) interactive desktop. All services run on other non-visible and non-interactive desktops. Therefore, they cannot communicate. You can try to check the box "Allow Service To Communicate With Desktop" in service' Startup Options to see, if it makes any difference. This option makes a service to run on the interactive desktop. Highly not recommended.
There could be other reasons, I guess. But you check those first.
If the code can run a simple netstat.exe and produced a file with content successfully, I am wondering if CF server couldn't see the gpg.exe?