Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2012
    • 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 2012
    • 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:

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 option Network Reset in Settings panel or use the command: netsh int ip reset

0 comment
4
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

Create Organizational Units (OU) Structure in Active Directory...

May 17, 2022

Windows Security Won’t Open or Shows a Blank...

May 17, 2022

How to Manually Install Windows Updates from CAB...

May 16, 2022

RDS and RemoteApp Performance Issues on Windows Server...

May 16, 2022

Deploying Software (MSI Packages) Using Group Policy

May 12, 2022

Leave a Comment Cancel Reply

Categories

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

Recent Posts

  • Create Organizational Units (OU) Structure in Active Directory with PowerShell

    May 17, 2022
  • Windows Security Won’t Open or Shows a Blank Screen on Windows 10/ 11

    May 17, 2022
  • How to Manually Install Windows Updates from CAB and MSU Files?

    May 16, 2022
  • RDS and RemoteApp Performance Issues on Windows Server 2019/2016

    May 16, 2022
  • Deploying Software (MSI Packages) Using Group Policy

    May 12, 2022
  • Updating VMware ESXi Host from the Command Line

    May 11, 2022
  • Enable or Disable MFA for Users in Azure/Microsoft 365

    April 27, 2022
  • Fix: You’ll Need a New App to Open This Windows Defender Link

    April 27, 2022
  • How to Reset an Active Directory User Password with PowerShell and ADUC?

    April 27, 2022
  • How to Completely Uninstall Previous Versions of Office with Removal Scripts?

    April 26, 2022

Follow us

woshub.com

ad

  • Facebook
  • Twitter
  • RSS
Popular Posts
  • Installing RSAT Administration Tools on Windows 10 and 11
  • Get-ADUser: Find Active Directory User Info with PowerShell
  • How to Hide Installed Programs in Windows 10 and 11?
  • Manage Windows Updates with PSWindowsUpdate PowerShell Module
  • Tracking and Analyzing Remote Desktop Connection Logs in Windows
  • PowerShell: Get Folder Sizes on Disk in Windows
  • How to Automatically Fill the Computer Description in Active Directory?
Footer Logo

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


Back To Top