-->

How to Check SMB Leasing in Windows 11

    How to Check SMB Leasing in Windows 11
    Learn how to check SMB leasing in Windows 11 using PowerShell, inspect share leasing modes, and troubleshoot SMB file access and performance.

    SMB leasing is an important feature of the Server Message Block protocol that can improve the efficiency of file access over a network. It works with SMB caching and coordination mechanisms to reduce unnecessary communication between an SMB client and server.

    If you use Windows 11 to access files on another Windows computer, file server, or NAS device, SMB leasing can be relevant when investigating network file performance and application compatibility.

    Windows provides several PowerShell commands that can help you inspect SMB leasing configuration. You can check the SMB server configuration, inspect the leasing mode of individual shares, and compare these settings with other SMB features such as opportunistic locking, encryption, signing, Multichannel, and compression.

    In this guide, you will learn how to check SMB leasing in Windows 11, understand the relevant settings, inspect individual SMB shares, and troubleshoot problems without changing SMB configuration unnecessarily.

    What Is SMB Leasing?

    SMB leasing is an SMB feature that allows a client to cache information associated with files on an SMB share and coordinate that cached state with the server.

    The purpose is to reduce unnecessary network operations while maintaining consistency between the client and server.

    This can be particularly useful when an application repeatedly accesses files stored on a network share. Instead of requiring every operation to result in the same amount of communication with the server, SMB can use leasing and related caching mechanisms where appropriate.

    SMB leasing is closely related to opportunistic locking, or oplocks, but the terms should not be treated as identical.

    Microsoft exposes SMB leasing behavior through both server-level configuration and share-level settings. This makes it possible to inspect the overall SMB server configuration as well as the behavior configured for a particular share.

    SMB Leasing vs SMB Oplocks

    SMB leasing and opportunistic locking are related because both are involved in client-side caching and coordination of network file access.

    However, they are not simply two names for exactly the same feature.

    In Windows SMB configuration, you may encounter settings such as:

    • EnableLeasing
    • EnableOplocks
    • LeasingMode
    • EnableDirectoryHandleLeasing

    These settings operate at different levels.

    For a practical troubleshooting workflow, check the server configuration first, then inspect the specific SMB share involved in the problem.

    If you also need to investigate oplocks, see How to Check SMB Opportunistic Locking (Oplocks) in Windows 11.

    Why Check SMB Leasing?

    Checking SMB leasing can be useful when troubleshooting network file access, application compatibility, or unexpected performance differences between SMB shares.

    Common reasons to inspect the setting include:

    • Applications access files from an SMB share unusually slowly.
    • Network file performance differs between two shares.
    • A legacy application behaves differently when files are stored on a network share.
    • You are comparing the configuration of two SMB servers.
    • You need to determine whether leasing has been disabled.
    • You are troubleshooting client-side caching behavior.
    • You want to document the current SMB configuration before making changes.

    Checking the configuration is generally safer than immediately modifying it. Start by recording the current values and identifying the actual problem.

    Important SMB Leasing Settings in Windows

    Several settings can appear when examining modern SMB server configuration.

    EnableLeasing

    EnableLeasing is an SMB server configuration setting related to SMB leasing behavior.

    You can inspect it with:

    Get-SmbServerConfiguration | Select-Object EnableLeasing

    A typical result may look like this:

    EnableLeasing
    -------------
    True

    The actual value on your computer is what matters.

    EnableOplocks

    EnableOplocks controls SMB opportunistic locking behavior on the server.

    Check it with:

    Get-SmbServerConfiguration | Select-Object EnableOplocks

    Because leasing and oplocks are related to SMB caching and coordination, it is useful to inspect both when troubleshooting a file-access problem.

    EnableDirectoryHandleLeasing

    Modern SMB server configuration can also include EnableDirectoryHandleLeasing.

    Directory handle leasing allows the server to cache directory handles for longer periods, which can reduce network traffic for workloads that perform many directory operations.

    Check the setting with:

    Get-SmbServerConfiguration | Select-Object EnableDirectoryHandleLeasing

    This is related to directory operations rather than being a replacement for ordinary SMB file leasing.

    How to Check SMB Leasing in Windows 11

    The simplest way to check the server-level SMB leasing configuration is with PowerShell.

    Step 1: Open PowerShell

    Open PowerShell from the Windows 11 Start menu.

    For SMB configuration troubleshooting, an elevated PowerShell window is recommended because some configuration and diagnostic operations require administrative privileges.

    Step 2: Run Get-SmbServerConfiguration

    Get-SmbServerConfiguration

    This command displays the SMB server configuration available on the computer.

    The output contains many properties, so you can filter the result when you only need to inspect leasing-related settings.

    Step 3: Check the Main Leasing Settings

    Use:

    Get-SmbServerConfiguration | Select-Object EnableLeasing, EnableOplocks, EnableDirectoryHandleLeasing

    This provides a compact view of three related SMB configuration areas.

    For example:

    EnableLeasing EnableOplocks EnableDirectoryHandleLeasing
    ------------ ------------- ----------------------------
    True         True          True

    Your values may be different.

    How to Check SMB Leasing for Individual Shares

    Checking the server-level setting is only part of the process. Windows also exposes a LeasingMode property for SMB shares.

    List the SMB shares with:

    Get-SmbShare

    To display the share name and leasing mode:

    Get-SmbShare | Select-Object Name, Path, LeasingMode

    The output may look similar to:

    Name       Path             LeasingMode
    ----       ----             -----------
    Documents  C:\Shares\Docs   Full
    Projects   D:\Projects      Full
    Legacy     D:\Legacy        Shared

    The exact output depends on the SMB shares configured on your computer.

    Understanding SMB LeasingMode

    The LeasingMode property is especially important because it describes the leasing and oplock behavior configured for a particular SMB share.

    Microsoft documents three relevant values.

    Full

    Full uses the default lease and oplock behaviors provided by SMB3.

    This is the normal modern SMB behavior for a share that is intended to use the standard SMB3 leasing and caching mechanisms.

    Shared

    Shared allows read-caching leases but does not provide write or handle-caching in the same way as the full mode.

    This mode can be relevant for application-compatibility scenarios where the default SMB3 behavior is not appropriate for a particular workload.

    None

    None disables oplocks and leases for the share.

    Microsoft specifically notes that disabling oplocks is not recommended in general and may only be appropriate for certain application-compatibility scenarios.

    Do not select None simply because a network share feels slow. Investigate the actual cause first.

    Check One SMB Share

    If you already know the name of the share you want to investigate, you can query it directly.

    Get-SmbShare -Name "Documents" | Select-Object Name, Path, LeasingMode

    Replace Documents with the actual share name.

    This is useful when a server contains many shares and only one application or folder is experiencing a problem.

    Check All SMB Share Settings

    You can combine leasing with other important SMB share properties:

    Get-SmbShare | Select-Object `
    Name, Path, CachingMode, LeasingMode, EncryptData, CompressData

    This gives you a broader overview of each share.

    For example, a result might show:

    Name       Path             CachingMode LeasingMode EncryptData CompressData
    ----       ----             ----------- ----------- ----------- ------------
    Documents  C:\Shares\Docs   None        Full        False       True
    Projects   D:\Projects      None        Full        True        False

    The values shown on your system can be different.

    This type of comparison can be useful when two shares on the same server have different performance or security characteristics.

    Check the SMB Server Configuration and Share Together

    For a more complete leasing check, run both commands.

    Get-SmbServerConfiguration |
    Select-Object EnableLeasing, EnableOplocks, EnableDirectoryHandleLeasing

    Then:

    Get-SmbShare |
    Select-Object Name, Path, LeasingMode

    The first command tells you about server-level behavior, while the second shows the leasing mode associated with individual shares.

    This distinction is important because a server can have multiple shares with different configuration characteristics.

    Check the Active SMB Connection

    After inspecting the configuration, check whether the Windows 11 client actually has an active SMB connection to the server.

    Get-SmbConnection

    For a more useful summary:

    Get-SmbConnection |
    Select-Object ServerName, ShareName, UserName, Dialect, Encrypted, NumOpens

    This can help you identify the server and share involved in the troubleshooting session.

    For more details, see How to Check SMB Connections in Windows 11.

    Check the SMB Dialect

    The negotiated SMB dialect is another important piece of information when troubleshooting leasing behavior.

    Get-SmbConnection |
    Select-Object ServerName, ShareName, Dialect

    For example, a modern connection may show an SMB 3.x dialect.

    If a particular device uses an older SMB implementation, its capabilities and behavior can differ from a modern Windows SMB server.

    See How to Check SMB Dialect in Windows 11 for a detailed explanation of SMB dialect negotiation.

    Check SMB Sessions on the Server

    If the computer hosting the share is accessible for administration, inspect active SMB sessions.

    Get-SmbSession

    To display useful properties:

    Get-SmbSession |
    Select-Object SessionId, ClientComputerName, ClientUserName, NumOpens

    This can help identify which client is accessing the SMB server when several computers are connected.

    For a complete guide, see How to Check SMB Sessions in Windows 11.

    Check Open SMB Files

    If the problem involves files that appear locked or unavailable, inspect open SMB files.

    Get-SmbOpenFile

    You can display selected information:

    Get-SmbOpenFile |
    Select-Object ClientComputerName, ClientUserName, FileName, ShareRelativePath

    This can help determine whether a specific client or user currently has a file open through SMB.

    See How to Check Open SMB Files in Windows 11 for more detailed commands.

    SMB Leasing and Directory Handle Leasing

    SMB leasing should also be distinguished from directory handle leasing.

    Directory handle leasing deals specifically with directory handles. Microsoft documents that enabling it can allow the server to cache directory handles for longer periods, which can improve performance for workloads involving many directory operations.

    To check it:

    Get-SmbServerConfiguration |
    Select-Object EnableDirectoryHandleLeasing

    For example:

    EnableDirectoryHandleLeasing
    ----------------------------
    True

    Do not assume that directory handle leasing and file leasing are interchangeable. They address related but different caching behavior.

    SMB Leasing and Caching

    SMB leasing is part of a larger group of caching and coordination mechanisms.

    When investigating SMB performance, it is therefore useful to consider:

    • SMB leasing.
    • SMB opportunistic locking.
    • Directory handle leasing.
    • SMB Multichannel.
    • SMB dialect.
    • Network link speed.
    • SMB encryption.
    • SMB compression.
    • Share permissions.
    • NTFS permissions.

    Changing one setting without understanding the rest of the SMB configuration can make troubleshooting more difficult.

    How to Change the Leasing Mode of an SMB Share

    Windows provides Set-SmbShare for changing SMB share properties.

    Before changing the leasing mode, check the current value:

    Get-SmbShare -Name "Documents" |
    Select-Object Name, Path, LeasingMode

    If a controlled application-compatibility test requires a different mode, the documented parameter is -LeasingMode.

    For example:

    Set-SmbShare -Name "Documents" -LeasingMode Shared

    After making the change, verify the result:

    Get-SmbShare -Name "Documents" |
    Select-Object Name, LeasingMode

    Do not change a production share simply as a generic performance tweak. Test the effect against the application or workload that is actually experiencing the problem.

    How to Restore Full Leasing Behavior

    If you previously changed a share to another leasing mode and want to test the standard SMB3 behavior again, you can set the share to Full:

    Set-SmbShare -Name "Documents" -LeasingMode Full

    Then verify:

    Get-SmbShare -Name "Documents" |
    Select-Object Name, LeasingMode

    Remember that configuration changes should be documented, especially on business file servers.

    How to Check SMB Leasing Without Changing Anything

    If your goal is only diagnosis, you do not need to modify the SMB configuration.

    Use these read-only inspection commands:

    Get-SmbServerConfiguration |
    Select-Object EnableLeasing, EnableOplocks, EnableDirectoryHandleLeasing
    Get-SmbShare |
    Select-Object Name, Path, LeasingMode
    Get-SmbConnection |
    Select-Object ServerName, ShareName, Dialect, Encrypted, NumOpens

    These commands give you a useful baseline before making any configuration changes.

    SMB Leasing Troubleshooting Workflow

    If an application has a problem with files stored on an SMB share, use a structured troubleshooting process.

    1. Identify the affected SMB server.
    2. Identify the affected share.
    3. Check the SMB server configuration.
    4. Check the share's LeasingMode.
    5. Check the active SMB connection.
    6. Check the negotiated SMB dialect.
    7. Check active SMB sessions.
    8. Check open SMB files.
    9. Compare the affected share with a working share.
    10. Test the application again.

    Also check basic networking and Windows file-sharing configuration if the problem is not specific to SMB caching behavior.

    Useful related guides include How to Check Network Profile in Windows 11, How to Check Network Discovery Settings in Windows 11, and How to Check Windows 11 Firewall Settings.

    SMB Leasing and SMB Multichannel

    SMB leasing and SMB Multichannel solve different problems.

    Leasing is related to caching and coordination of file access, while Multichannel allows SMB to use multiple network paths or channels when the environment supports it.

    If a file server appears slow during large transfers, inspect both areas rather than assuming that leasing is responsible.

    You can review Multichannel with:

    Get-SmbMultichannelConnection

    See How to Check SMB Multichannel in Windows 11 for more information.

    SMB Leasing and SMB Encryption

    Encryption and leasing also have different purposes.

    SMB encryption protects SMB traffic, while leasing is related to client-side caching and coordination.

    If you are troubleshooting performance, check whether the active SMB connection is encrypted:

    Get-SmbConnection |
    Select-Object ServerName, ShareName, Dialect, Encrypted

    For a detailed guide, see How to Check SMB Encryption in Windows 11.

    SMB Leasing and SMB Compression

    SMB compression is another separate SMB feature.

    Compression can reduce the amount of data transmitted over a network, while leasing is concerned with caching and file-access coordination.

    When troubleshooting SMB performance, it is useful to identify which feature is actually relevant to the workload instead of changing multiple settings at once.

    See How to Check SMB Compression in Windows 11 for the related configuration and diagnostic commands.

    Useful PowerShell Commands for SMB Leasing

    Purpose PowerShell Command
    View SMB server configuration Get-SmbServerConfiguration
    Check server leasing Get-SmbServerConfiguration | Select-Object EnableLeasing
    Check server oplocks Get-SmbServerConfiguration | Select-Object EnableOplocks
    Check directory handle leasing Get-SmbServerConfiguration | Select-Object EnableDirectoryHandleLeasing
    List SMB shares Get-SmbShare
    Check share leasing mode Get-SmbShare | Select-Object Name, Path, LeasingMode
    Check one share Get-SmbShare -Name "Documents" | Select-Object Name, LeasingMode
    Change share leasing mode Set-SmbShare -Name "Documents" -LeasingMode Full
    View active SMB connections Get-SmbConnection
    View SMB sessions Get-SmbSession
    View open SMB files Get-SmbOpenFile

    Related SMB Guides

    This article is part of a larger Windows 11 SMB troubleshooting series. The following guides can help you investigate related SMB settings and behavior:

    Frequently Asked Questions

    What is SMB leasing?

    SMB leasing is a mechanism that allows SMB clients to use caching and coordinate cached file information with the SMB server, helping reduce unnecessary network operations.

    How do I check SMB leasing in Windows 11?

    On an SMB server, run Get-SmbServerConfiguration | Select-Object EnableLeasing. You can also inspect individual shares with Get-SmbShare | Select-Object Name, Path, LeasingMode.

    What is EnableLeasing?

    EnableLeasing is an SMB server configuration setting related to SMB leasing behavior.

    What is LeasingMode?

    LeasingMode is an SMB share-level setting that specifies SMB leasing and oplock behavior for application compatibility. Its documented values are Full, Shared, and None.

    What does LeasingMode Full mean?

    Full uses the default lease and oplock behaviors from SMB3.

    What does LeasingMode Shared mean?

    Shared allows read-caching leases but does not provide write or handle-caching in the same manner as full leasing behavior.

    What does LeasingMode None mean?

    None disables oplocks and leases for the share. It is intended for compatibility scenarios rather than normal SMB performance tuning.

    Should I disable SMB leasing to improve performance?

    No. Do not disable SMB leasing simply as a performance optimization. First identify the actual problem, document the current configuration, and test any change against the affected application or workload.

    Is SMB leasing the same as SMB oplocks?

    No. They are related SMB caching and coordination mechanisms, but Windows exposes them through different configuration properties and share-level behavior.

    What is directory handle leasing?

    Directory handle leasing allows the SMB server to cache directory handles and can reduce network traffic for workloads that perform many directory operations.

    Final Thoughts

    Checking SMB leasing is a useful diagnostic step when investigating Windows 11 network file-sharing behavior.

    The most important server-level property is EnableLeasing, while individual SMB shares expose LeasingMode. You can also inspect EnableOplocks and EnableDirectoryHandleLeasing when investigating related caching behavior.

    For reliable troubleshooting, do not change leasing settings blindly. First identify the affected server and share, inspect the current configuration, check active SMB connections and sessions, verify the SMB dialect, and investigate open files.

    Once the existing configuration is documented, you can perform controlled tests and determine whether SMB leasing is actually related to the problem.

    LihatTutupKomentar