From time to time, users of the file server may report that the contents of network folders don’t refresh automatically and new files are not immediately visible in the folder view (take a long time to appear).
New Files in the Shared Folder are Not Showing Up
For example, if a user creates a new file in a network folder (via a UNC path or on a mapped network drive), it will appear in the folder after a delay of 3–4 minutes, even if the folder contents are refreshed manually in File Explorer using the F5 key. However, if you manually enter the full UNC path to the file in the File Explorer address bar (\\lon-file-srv1\public\new_file.docx), the file opens immediately, but may not be displayed in the shared folder’s content view
The issue of shared folder contents not refreshing immediately in File Explorer after files and folders are created, deleted, renamed, or moved is typically due to Windows’ shared folder caching. The most common sources of the problem are:
- The files in the shared folder are cached using the Offline Files feature
- The SMB client caches the metadata of shared folder objects
Disable Offline Files Cache in Windows
By default, users can access all shared network folders offline because their content can be cached locally on the client (using the built-in Offline Files feature). You can prevent users from caching the contents of a shared folder by disabling offline file caching in the folder’s properties.
Open the properties of the shared folder on the Windows file server, and go to the Sharing tab -> Advanced Sharing -> Caching. Change the mode to No files or programs from the shared folder are available offline.
You can change the shared folder settings using the PowerShell command from the built-in SMBShare module:
Set-SMBShare -Name MySharedDocs -CachingMode None
Get-SmbShare -Name MyShareDocs| fl -Property CachingMode
Managing SMB Shared Folders Caching on Clients
The Network Redirector feature was introduced in the SMB v2.0 protocol to improve client access to shared network folders (see the table showing the different versions of the SMB protocol). This component’s purpose is to reduce traffic and SMB requests between clients and servers by caching shared folder metadata on clients’ devices. The SMB Network Redirector clears the contents of the client’s cache every 10 seconds by default.
SMB caching may not work properly if there are thousands of files and folders in a shared folder, or if SMB clients connect to the file server over a slow or unreliable network. This results in slow refreshes of the contents of shared folders for users. To reduce latency and improve content refresh in shared folders, try disabling SMB protocol metadata caching on the client side.
Use the PowerShell command to list the current caching settings on the SMB client.
Get-SmbClientConfiguration | select DirectoryCacheLifetime, FileInfoCacheLifetime, FileNotFoundCacheLifetime
- DirectoryCacheLifetime –is the lifetime of the shared folder metadata cache obtained during the last access (default
10 seconds). During this time, the SMB client uses cached data rather than querying the SMB server for data. This improves performance, but may result in a slight delay when refreshing folder content. - FileNotFoundCacheLifetime – ‘File not found’ response cache (
5 seconds) - FileInfoCacheLifetime – is the time for storing the cache with the file info (
10 seconds).
According to Microsoft, the default values for these registry options provide optimal performance in most environments. Although the network and SMB server load decrease with a longer cache lifetime, users may experience more frequent delays when viewing updates in shared folders.
To disable metadata caching for shared SMB folders completely, set these parameters to 0:
Set-SmbClientConfiguration -DirectoryCacheLifetime 0 -FileInfoCacheLifetime 0 -FileNotFoundCacheLifetime 0
In older versions of Windows that do not support the Set-SmbClientConfiguration cmdlet, you can modify these parameters directly in the registry under the reg key HKLM\System\CurrentControlSet\Services\LanmanWorkstation\Parameters
You can create these 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
Restart the computer to apply the settings. If these parameters need to be applied to multiple domain computers, you can use the GPO to deploy registry settings.
After applying this fix, any changes made to the shared folder will be displayed on the client immediately. This is because the folder contents are updated each time, rather than using the local cache. However, bear in mind that disabling network folder caching increases network traffic and reduces the performance of the file server.
- Enabling the Access-based Enumeration (ABE) option for a shared folder can cause the file list to refresh slowly when the folder contains 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 disabling the legacy NetBIOS protocol in the properties of your TCP/IPv4 connection (
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
- If the shared folder is published on a DFS server, clear the cache on the server.
dfsutil cache referral flush
dfsutil /pktflush
dfsutil /purgemupcache




2 comments
Mir ist grade aufgefallen, dass es zu Beginn für 10-30 Sekunden schnell lädt (300-1000 mbit/s) und es danach dann runtergeht, auf paar kb/s, mit 10 Sekundenpausen zwischen den Pieks.
Der Kundenrechner ist in einer Domain und ich kann da nicht alles ausprobieren.
Set-SmbClientConfiguration -DirectoryCacheLifetime 0
Set-SmbClientConfiguration -FileInfoCacheLifetime 0
Set-SmbClientConfiguration -FileNotFoundCacheLifetime 0
Get-SmbClientConfiguration | Select *cache*
hat jedenfalls nichts geholfen (immer wieder witzig, dass man durch Abschalten eines Cache, der es ja eigentlich schneller machen soll, etwas schneller macht, anstatt langsamer … da hat jemand beim Delphi-Compiler abgeguckt )
[…] -FileNotFoundCacheLifetime 0 Get-SmbClientConfiguration| select *cache* von hat jedenfalls nichts geholfen (immer wieder witzig, dass man durch Abschalten eines Cache, der es […]https://www.delphipraxis.net/210601-start-von-share-ploetzlich-extrem-langsam-2.html#post1506023
I might be wrong but I have a suspicion this sometimes happens because Windows tries to log in with your current account first and retries or something but there’s a big timeout to prevent brute force. Perhaps cycling through authentication methods. Only when it gives up and the last timeout elapses does the password prompt for you to manually do it come up. Perhaps there are some settings somewhere so as to not do this and instead immediately try to manually log in or something.