Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows 10 / Slow Access to Shared Folders and Network Drives in Windows

March 4, 2022 PowerShellWindows 10Windows 7Windows Server 2016

Slow Access to Shared Folders and Network Drives in Windows

Our users are complaining about very slow network performance when opening or saving files to a network shared folder in Windows. When a user opens a shared folder via a UNC path, or via a drive letter (if the shared folder is mapped as a network drive), its contents are displayed only in 10-60 seconds. When creating new files in a network folder, they are also not displayed immediately, but with a long delay after 3-4 minutes (even if you update the folder contents with the F5 key). However, if you manually specify the full file name via a UNC path (\\lon-file-srv1\public\new_file.docx), it will open, although it won’t be visible in the File Explorer.

Slow access to network drive or folder from Windows

Windows uses a special Network Redirector component when access shared files and other network resources on remote computers. Starting with SMB v2.x (see the table with Server Message Block protocol versions), the Network Redirector uses a caching mechanism when accessing shared folders and files over the network. This reduces the traffic and the number of SMB requests between the client and the server (especially effective on in slow and unreliable networks). By default, this cache is cleared every 10 seconds.

If you are experiencing slow access to a network share on a Windows client device, you can try disabling the SMB metadata caching on the client side or in the shared folder settings.

You can disable SMB caching in the shared folder settings. Open the properties of the shared folder, and go to the Sharing tab -> Advanced Sharing -> Caching. Select the second option “No files or programs from the shared folder are available offline”.

disable network share caching in windows

Or use the PowerShell command from the built-in SMBShare module:

Set-SMBShare -Name MySharedDocs -CachingMode None

This will disable both caching and offline access to this shared folder (see the article on using offline files in Windows).

There are three registry parameters that manage network shared folder cache settings on the SMB client side. Microsoft states that the default values for these registry options provide the best performance for most environments. The SMB cache settings are located under the registry key HKLM\System\CurrentControlSet\Services\LanmanWorkstation\Parameters.

  • DirectoryCacheLifetime is the lifetime of the shared folder metadata cache (10 seconds by default);
  • FileNotFoundCacheLifetime – “File not found” response cache (5 seconds);
  • FileInfoCacheLifetime – the time of keeping the cache with the file info (10 seconds).
You can find information about these registry settings in the article on optimizing Windows file server settings: https://docs.microsoft.com/en-us/windows-server/administration/performance-tuning/role/file-server/

By default, the cache lifetime for an SMB share folder is only 10 seconds. When a client refresh the contents of a shared folder, the result of the last update is stored by the client for 10 seconds. When accessing this network share, all applications first try to use this cache.

In some cases, the mechanism for caching data in SMB folders doesn’t work correctly (most often this happens with network folders/drives containing thousands of files and folders). In this case, users may experience significant delays when opening, viewing, and creating files in shared folders.

You can disable caching for SMB folders. To do this, create a new DWORD parameter under the HKLM\System\CurrentControlSet\Services\LanmanWorkstation\Parameters registry key with the name DirectoryCacheLifetime and a value of 0. Also set the values of the FileInfoCacheLifetime and FileNotFoundCacheLifetime parameters to 0. You can create this registry parameters using regedit.exe or with the New-ItemProperty PowerShell cmdlet:

$regpath= "HKLM:\System\CurrentControlSet\Services\LanmanWorkstation\Parameters"
$Name1 = "DirectoryCacheLifetime"
$Name2 = "FileInfoCacheLifetime"
$Name3 = "FileNotFoundCacheLifetime"
New-ItemProperty -Path $regpath -Name DirectoryCacheLifetime -Value 0 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $regpath -Name FileInfoCacheLifetime -Value 0 -PropertyType DWORD -Force | Out-Null
New-ItemProperty -Path $regpath -Name FileNotFoundCacheLifetime -Value 0 -PropertyType DWORD -Force | Out-Null

DirectoryCacheLifetime registry parameter can fix slow access to files on shared folders

You must restart your computer for the settings to take effect. If these parameters need to be applied to multiple domain computers, you can use the GPO to deploy the registry settings.

Disabling network folder caching increases network traffic and reduces file-server performance.

You can also use the Set-SmbClientConfiguration cmdlet to fine-tune the SMB client:

Set-SmbClientConfiguration -DirectoryCacheLifetime 0
Set-SmbClientConfiguration -FileInfoCacheLifetime 0
Set-SmbClientConfiguration -FileNotFoundCacheLifetime 0

You can list the current caching settings for the Windows SMB client with PowerShell:

Get-SmbClientConfiguration| select *cache*

DirectoryCacheEntriesMax : 16
DirectoryCacheEntrySizeMax : 65536
DirectoryCacheLifetime : 0
FileInfoCacheEntriesMax : 64
FileInfoCacheLifetime : 0
FileNotFoundCacheEntriesMax : 128
FileNotFoundCacheLifetime : 0

powershell get-smbclientconfiguration cachelifetime

After that, all changes in the shared will be immediately displayed on the client (the contents of the folder are refreshed each time it is accessed and the local cache is not used).

There are several other reasons for poor network performance of shared folders, or when the contents of folders may appear slowly:

  • Enabling the “Access-based Enumeration (ABE)” option in the shared folder settings can lead to a slow update of the list of files in a shared folder with a large number of objects;
  • You may experience slow network speed on Hyper-V virtual machines running on Windows Server 2019 (compared to Windows Server 2016/2012R2);
  • Try to disable the legacy NetBIOS protocol in the properties of your TCP/IPv4 connection on the domain-joined devices (ncpa.cpl -> open the network adapter’s TCP/IPv4 settings and select Disable NetBIOS over TCPIP on the WINS tab);
  • Try resetting the network and TCP/IP stack settings on the Windows client device. On Windows 10+, you can use the Network Reset option in the Settings panel or use the command: netsh int ip reset

1 comment
5
Facebook Twitter Google + Pinterest
previous post
Couldn’t Verify Office 365 (Microsoft 365) Subscription
next post
How to Upgrade VM Hardware Version in VMware ESXi?

Related Reading

Configuring Event Viewer Log Size on Windows

May 24, 2023

How to Detect Who Changed the File/Folder NTFS...

May 24, 2023

Enable Single Sign-On (SSO) Authentication on RDS Windows...

May 23, 2023

Allow Non-admin Users RDP Access to Windows Server

May 22, 2023

How to Create, Change, and Remove Local Users...

May 17, 2023

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Configuring Event Viewer Log Size on Windows

    May 24, 2023
  • How to Detect Who Changed the File/Folder NTFS Permissions on Windows?

    May 24, 2023
  • Enable Single Sign-On (SSO) Authentication on RDS Windows Server

    May 23, 2023
  • Allow Non-admin Users RDP Access to Windows Server

    May 22, 2023
  • How to Create, Change, and Remove Local Users or Groups with PowerShell?

    May 17, 2023
  • Fix: BSOD Error 0x0000007B (INACCESSABLE_BOOT_DEVICE) on Windows

    May 16, 2023
  • View Success and Failed Local Logon Attempts on Windows

    May 2, 2023
  • Fix: “Something Went Wrong” Error When Installing Teams

    May 2, 2023
  • Querying Windows Event Logs with PowerShell

    May 2, 2023
  • Configure Windows LAPS (Local Administrator Passwords Solution) in AD

    April 25, 2023

Follow us

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Installing RSAT Administration Tools on Windows 10 and 11
  • Configuring Port Forwarding in Windows
  • Start Menu or Taskbar Search Not Working in Windows 10/11
  • How to Delete Old User Profiles in Windows?
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • Adding Drivers into VMWare ESXi Installation Image
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top