Command line Method

net config server /autodisconnect:-1





Registry Editor Method:

  1. Click Start, click Run, type regedit, and then click OK.

  2. Locate and then click the following key in the registry:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\parameters

  3. In the right pane, click the autodisconnect value, and then on the Edit menu, click Modify. If the autodisconnect value doesn't exist, follow these steps:

    1. On the Edit menu, point to New, and then click REG_DWORD.
    2. Type autodisconnect, and then press ENTER.
  4. On the Edit menu, click Modify.

  5. Click Hexadecimal.

  6. In the Value data box, type ffffffff, and then click OK.

The client-side session is automatically disconnected when the idling time lasts more than the duration that is set in KeepConn. Therefore, the session is disconnected according to the shorter set duration value between AutoDisConnect and KeepConn. To change the time-out duration in the client-side during a UNC connection, specify the arbitrary time in KeepConn. Locate and then click the following key in the registry:

  • Location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanworkstation\parameters
  • Value: KeepConn
  • Data type: REG_DWORD
  • Range: 1 to 65535 (sec)
  • Default value: 600 sec = 10 mins






https://learn.microsoft.com/en-us/troubleshoot/windows-client/networking/mapped-drive-connection-to-network-share-lost



https://thegeekpage.com/network-drive-keeps-disconnecting-in-windows-10-fix/