Skip to content

Oplocks Windows Networking

Peer to Peer LAN networks (Not required for Terminal Servers or RocketProfit Systems) - technical details

Some background:

Windows computers share network drives using SMB 1 or SMB 2/3 Both the server and workstation need to support the same version of SMB for the workstation to access data files on the server.

If we run our oplocks.exe program on a workstation or server, it disables SMB 2/3 and forces Windows to use SMB 1. This fixes data corruption due to opportunistic locking. If a server upgrades to Windows 10 1709 or later, SMB 1 is automatically disabled and SMB 2/3 is enabled.

If a server is running SMB 2/3, the LeasingMode must be set to None. This prevents data corruption.

If you see the following message, it means that the computer you are on (probably a workstation) has updated to Windows 1709 or later and SMB 1 is now disabled. The workstation is trying to connect to a server where SMB 1 is enabled, but the workstation can't use SMB 1, it must use SMB 2/3. The server should be updated to Windows 1709 or later which will enabled SMB 2/3, and the LeasingMode on the server should be set to None.

Best practice

Update all computers to the latest version of Windows 10 (1709 or later), which will enable SMB 2/3

Run the Powershell command B below that will set the LeasingMode to None.

All windows clients and servers should be running the same build of Windows 10.

To disable oplocks in Windows PRIOR to version 1709, Fall Creator Update.

This will turn off SMB 2&3 leaving only SMB for the client or workstation to use.

Windows 10 prior to version 1709 and Server 2008 use a Microsoft technology called Oplocks (opportunistic locks) to accelerate file access for networked file servers. If a Windows 10 computer, or a Server 2008 computer is configured as a ProfitSystem© server, then Oplocks will normally be enabled automatically by Windows. However, using Oplocks can cause data corruption problems with ProfitSystem© data files. For this reason, ProfitSystem© will disable Oplocks during server installation, and also when the program is run for the first time.

It does this by running a small program called Oplocks.exe, which is installed in the Program Files\ProfitSystem folder. This program should be run on both the workstation and server. It disables Oplocks by updating the following registry keys:

Locate “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters\OplocksDisabled”. “Value data” should be 1. Add DWORD (32-bit) Value if missing. Locate “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\EnableOplocks. “Value data” should be 0. Add DWORD (32-bit) Value if missing. Locate “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\SMB2”. “Value data” should be 0. Add DWORD (32-bit) Value if missing.

Disable 'oplocks' in Windows 1709, Fall Creator Update and later.

This would be done on the server, if the server has SMB 2&3 turned on, and the clients are also using SMB 2&3

Open an Administrator Powershell command prompt. Run:
Set-SmbShare ProfitSystem -LeasingMode None

Replace ProfitSystem with the actual share name.

https://support.microsoft.com/en-us/help/4034314/smbv1-is-not-installed-windows-10-and-windows-server-version-1709

Reference articles

https://support.microsoft.com/en-us/help/4034314/smbv1-is-not-installed-by-default-in-windows https://support.microsoft.com/en-us/help/2696547/how-to-detect-enable-and-disable-smbv1-smbv2-and-smbv3-in-windows-and