You can run an executable as a service under FireDaemon Pro even if that executable resides on a network drive. This article also discusses how to map network drives under FireDaemon Pro, should you application require access to one.
In order to run an executable off of a network drive, the following must occur or be true:
- The executable must be placed in a directory that is shared out
- The executable can be normally referenced via mapped drive (e.g. L:\path\file.exe) or via UNC path (eg. \\server\share\path\file.exe).
- Mapped drives or UNC (Universal/Uniform Naming Convention) paths can only be used if the service is run as a nominated local or domain user. See next point.
- If you intend to run the service as a nominated local or domain user then that user must have permission to access the network resource (i.e. share) in question. Further, if you want your application to Interact With The Desktop then you need to ensure that the local or domain user is in the Administrators group.
- If you want to use a mapped drive then you need to setup a Pre-Service Program within the service definition to complete the mapping.
- The application working directory can be either a mapped drive or UNC path. However, if a UNC path is used, a trailing slash (\) must be supplied (eg. \\server\share\path\)
Using a Mapped Drive
In this example we've dropped calc.exe on a network share drive. The share permission is Everybody Read Only. The share resides on a Windows 2003 server running Active Directory.
Set up the service in FireDaemon. Note that the drive letter for the Executable and Working Directory is included in the path to the file:
Now visit the Settings tab. Enter the logon credentials for the Windows user running the application and enter them in the Settings tab. In this case the service is running as the local administrator, which has sufficient permission to access the share on the Domain Controller. The service also Interacts with the Desktop, so be sure to check "Interact with Desktop".
Now visit the Pre/Post-Service tab. Configure the Pre-Service Program to map the drive by clicking Insert under the pre-service programs.
The Pre-Service parameters contain the drive letter to be mapped along with the UNC share. For more information, at a command prompt type "net use /?"
NOTE On 64-bit systems two versions of net.exe are provided. You must use the correct one. If you are using the 32-bit version of FireDaemon on a 64-bit machine, the drive mapping must occur in the 32-bit user space. Hence, use C:\WINDOWS\SysWOW64\net.exe in preference to C:\WINDOWS\system32\net.exe.
Using a UNC Path
Using a UNC (Universal/Uniform Naming Convention) path is similar to the previous example of using mapped drives except no explicit drive mapping is required via the Pre-Service. Note the path to the Executable and the trailing slash on the Working Directory.
- Executable: \\sputum\data\calc.exe
- Working Directory: \\sputum\data\ (note the trailing slash)
The service must still run as a user with the appropriate permissions. You can adjust this in the Settings area:
Note that when using a UNC Path, no Pre-Service or Post-Service programs are required: