WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Run Winbatch as a Service

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

WB Service to Interact with Network Share

Keywords:   service  network share

Question:

I have a problem executing a command from a remote system. I need to run a command on the local NT box from a drive on a remote NT box. Executing it from an explorer listing works as does running it from a command line (giving the full path to the command).

For example, the line in a .wbt or .exe script " Run("G:\Dts\calc2.exe") " works fine when run from the local NT box (G: is on a different NT server). But, when this Winbatch script is run from a remote Unix box, a permission denied error is generated. The Error window shows "1932 WinExec: Access denied". I have also tried using RunShell, and ShellExecute. All three give the same result.

The Disk, Directory, and File permissions are all set to "EVERYONE - All Access". I have tried running it from inside a .bat file also.

The processes on the NT box that intercept and run the command from the Unix box are listed in the services as "Run as System" with the "Interface with Desktop" box checked. The user it is running as has administrator privileges.

I have tried numerous variations with this problem to no avail. Any help would be appreciated.

Answer:

  1. Almost *always* anything running as a service (like you seem to be doing) does NOT have network access privileges. I think that is the problem you are running up against.

    I don't see how it can be running under the administrator account, because if it is set to "interact with the desktop" then it must be running under the system account - and it generally never has network access privileges.

    Are you using the wwwnt32i.dll NT extender? Maybe add a wntRunAsUser function in there to help out.

    And it can't hurt to add:

    IntControl(1001,1,0,0,0) so that a user logging off does not cancel the script.

  2. To allow a WinBatch script running as a service (configured to run as local system and able to interact with the desktop) to access a network share requires that the following steps be taken on the remote system that hosts that share:

    • Add the share to the list of NullSessionShares in the registry. Use RegEdt32.exe to alter the value stored at HKLM\System\CurrentControlSet\Services\LanmanServer\Parameters[NullSessionShares]. Place the name of the share to be accessed in this list.

    • Make sure that the permissions on the share [and NTFS file permissions if on an NTFS volume] are set to allow READ access to "Everyone".

    Doing these things will make it possible for a service that has no credentials to access a network share. This does compromise system security on the server where these changes are made so be sure not to put anything important on the share.

    You can read about it with MSKB article 289655.


Article ID:   W14949
File Created: 2003:08:15:13:45:52
Last Updated: 2003:08:15:13:45:52