JSI Tip 9316. How do prevent Windows clients from requesting an opportunistic locks on a remote file?


Starting with Windows 2000 (NT 5.0), opportunistic locking is enabled for SMB (Server Message Block) clients.

I discussed opportunistic locking in tip 3108 » How do I configure Opportunistic Locking on Windows NT and Windows 2000?

You can prevent windows clients from requesting an opportunistic locks on a remote file by set the OplocksDisabled Value Name, a REG_DWORD data type, at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MRXSmb\Parameters to a data value of 1.

If you wanted to configure a number of remote clients, you could use OplocksDisabled.bat. The syntax for using OplocksDisabled.bat is:

OplocksDisabled Computer1 \[Computer2 ... ComputerN\]

Where ComputerX is the NetBIOS computer name of a windows client.

NOTE: OplocksDisabled.bat uses REG.EXE, built into Windows XP (NT 5.1) and later, or installed on Windows 2000 from the Support Tools on the operating system CD-ROM.

NOTE: A restart is required for this setting to become effective.

OplocksDisabled.bat contains:

@echo off
if \{%1\}

\{\} @echo Syntax: OplocksDisabled Computer1 \[Computer2 ... ComputerN\]&goto :EOF setlocal set key=HKLM\System\CurrentControlSet\Services\MRXSmb\Parameters :Loop if \{%1\}

\{\} endlocal&goto :EOF @echo REG ADD \\%computer%\%key% /V OplocksDisabled /T REG_DWORD /F /D 1 REG ADD \\%1\%key% /V OplocksDisabled /T REG_DWORD /F /D 1 @echo. shift goto Loop



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish