Microsoft KB Archive/231795

= How to Automatically Close a NetBIOS Session After the Program Using It Quits =

Article ID: 231795

Article Last Modified on 11/1/2006

-

APPLIES TO


 * Microsoft Windows NT Server 4.0 Standard Edition

-



This article was previously published under Q231795



SUMMARY
By default, unused NetBIOS sessions are disconnected after a 15-minute period of inactivity. If you need to disconnect a NetBIOS session (such as a drive mapping to a network resource) as soon as the program using it quits, you can do so by using the method described below. This may be necessary with some programs because they measure licensing by counting the connections to the server.



MORE INFORMATION
There is no built-in method in Windows NT to disconnect a drive mapping after a program quits. As a workaround, you can start the program from a batch file. The batch file maps the appropriate drive letter to the required share. Next, the batch file runs the program that uses the shared resource. Finally, the batch file disconnects the mapped drive.

For example:

net use : \\ \



net use : /delete

You may need to use a freeware, shareware, or third-party utility to introduce a wait period after the "z:\ .exe" line so that the batch file continues to run for a few seconds after the program quits. This allows enough time for the program to finish closing its connections before the following command to disconnect the connection runs.

NOTE: Although the client deletes the drive mapping, the NetBIOS session is not ended on the server for an additional 255 seconds.

