Disable Creating Thumbs.db on Network Folders

A few days ago I found an interesting peculiarity of Windows Explorer in Windows 10 when working with network shares. The problem was that right after copying or moving a directory in the share, the system refused to delete or rename it. You could only rename or delete this folder after a certain time between 1 and 5 minutes.

When trying to delete this network share, the following error appeared:

As it turned out, the matter was in Thumbs.db, the file containing thumbnails of images. Since Windows XP, Windows has been able to create the cache containing thumbnails of images (and other file types) and store it in the hidden file Thumbs.db in each directory.

Due to cache, the time to load and display thumbnail files in the Explorer is reduced. If the image cache is disabled, the system has to load image files and generate their thumbnails every time, which is resource consuming (especially in case of folders containing a lot of images).

However, as it turned out, there are cases like KB2025703 – Renaming a network folder in Windows 7 Explorer fails with “the action can’t be completed” when thumbs.db with the thumbnail cache prevents folders to be deleted or moved using Windows Explorer.

It seems, the system needs some time to generate the file containing thumbnail cache, and while this file is generated or updated, you can do nothing to its parent directory.

In this case, you can disable automatic generation of thumbs.db for network shares and drives.

In this case, you can disable automatic generation of thumbs.db for network shares and drives.

  • How to Disable Thumbs.db Generation on Network Shares Using GPO
  • How to Disable Thumbs.db on Network Shares Using the Registry
  • How to Delete Thumbs.db in All Folders with PowerShell

How to Disable Thumbs.db Generation on Network Shares Using GPO

In order Windows Explorer not to create a hidden cache file Thumbs.db, you can use GPO.

The policies we need are located in the following section of GPO Editor:

  • In Windows 7: User Configuration -> Policies -> Administrative Templates -> Windows Components -> Windows Explorer.
  • In Windows 8 and Windows 10: User Configuration -> Policies -> Administrative Templates -> Windows Components -> File Explorer

First of all, we are interested in the first policy, which prevents the Explorer from creating thumbs.db in network shares.

Now link this policy to the users OU and update it on the computers with gpupdate /force.

How to Disable Thumbs.db on  Network Shares Using the Registry

You can disable the creation of hidden files thumbs.db using the Registry Editor (regedit.exe).

Go to HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\ create the new key Explorer (it already exists in Windows 7), and create a REG_DWORD parameter with the name DisableThumbsDBOnNetworkFolders and give it the value “1

The same operation can be done with a single command:

reg add "HKCU\SOFTWARE\Policies\Microsoft\Windows\Explorer" /v DisableThumbsDBOnNetworkFolders /d 0x1 /t REG_DWORD /f

How to Delete Thumbs.db in All Folders using PowerShell

The existing files Thumbs.db are not automatically deleted after you enable the policy. You can recursively delete all Thumbs.db files on a separate disk or in a server directory using PowerShell.

Go to the folder you need:

cd c:\

Get the list of all files Thumbs.db:

Get-ChildItem -Path . -Include Thumbs.db -Recurse -Name -Force | Remove-Item –Force –WhatIF

Recursively delete these files:

Get-ChildItem -Path . -Include Thumbs.db -Recurse -Name -Force | Remove-Item –Force

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s