Windows 10 - disable opplocks\opportunistic locks using the set-smbclientconfiguration cmdlet - help

Algon 1 Reputation point
2021-12-08T17:31:42.137+00:00

Hi

I'm really hoping someone can help with this

We've got an old application hosted on a Windows 2012R2 server that requires us to disable oplocks so as to avoid data corruption in the flat files that are shared.
Unfortunately the only way to do this on server 2012R2 and below is to reduce it to SMBv1 first and then disable oplocks via registry key. This then means all our Windows 10 clients need to talk to the server using SMB1 - you can see the problem here.

I've noticed there's a switch for the set-smbclientconfiguration powershell cmdlet on Windows 10 which appears to allow you to disable opportunistic locking on the client side - Set SMBClientconfiguration -UseOpportunisticLocking $false

Has anyone else used this? Does this prevent the client from requesting a server oplock. If this is the case then we can enable SMB3 back on the 2012R2 server and allow the clients to talk SMB3.

Thanks in advance

Windows for business | Windows Server | User experience | Other
Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Algon 1 Reputation point
    2021-12-10T10:30:29.12+00:00

    Hi

    Thanks for the response but I think you're misunderstanding my question and perhaps I haven't explained it clearly enough.

    We don't want to use SMBv1 at all - We know how to enable\disable it on the clients and server.

    What we want to do is to use SMBv3 but disable oplocks to avoid any issues caused by them when using this legacy application.

    Unfortunately you can't disable oplocks on server 2012R2 under SMBv3. It's only possible to disable it under SMBv1, so you have disable SMB2\3 first before adding the reg key to disable oplocks.

    With our Windows 7 clients you didn't have to do this as SMBv1 was already in place but since replacing them with Windows 10 we have to enable SMBv1 so they can still talk to the server.

    However, in Windows 10 we've noticed an option under the set-smbclientconfiguration cmdlet which is "useOpportunisticLocking (which can be set to false" and "OplocksDisabled (which can be set to true)" . This looks as though we can tell the client not to use oplocks. If this is the case then implementing this option will allow us to re-enable SMBv3 on the server side and also the clients and prevent the issues caused by using oplocks.

    My question is - Is my understanding of the cmdlet correct? Will this option prevent the client from requesting an oplock on the server?

    Cheers

    0 comments No comments

  2. Algon 1 Reputation point
    2021-12-14T14:49:16.86+00:00

    Does anyone know about this cmdlet and this specific option?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.