Post

How to Disable Folder Discovery in Windows 11 with a PowerShell Script

Outline

If you’ve ever been annoyed by Windows 11 automatically changing the look and feel of your File Explorer based on the content of your folders, you’re not alone. This feature, known as folder discovery, can be helpful for some users but a nuisance for others who prefer a consistent view across all folders. Fortunately, there’s a way to disable this feature using a simple PowerShell script.

In this post, I will guide you through the steps to disable folder discovery in Windows 11 by modifying the Windows Registry.

What is Folder Discovery?

Folder discovery in Windows 11 is a feature that customizes the view settings of folders based on their content. For example, a folder with images might display thumbnails, while a folder with documents might show a list view. While this can be useful, it can also be frustrating if you prefer a uniform view for all folders.

Disabling Folder Discovery

To disable folder discovery, we need to edit the Windows Registry. This can be done manually, but using a PowerShell script makes the process faster and more reliable.

Prerequisites

  • Windows 11
  • PowerShell (Run as Administrator)

Backup Your Registry

Before running the script, it’s important to back up the relevant registry key to avoid any potential issues. Here’s how you can do it:

  1. Press Win + R, type regedit, and press Enter to open the Registry Editor.
  2. Navigate to the following path:
1
HKEY_CURRENT_USER\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell
  1. Right-click on the Shell key and select Export.
  2. Choose a location to save the backup file and give it a name.
  3. Click Save.

The PowerShell Script

Below is the PowerShell script that will disable folder discovery:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Define the registry path
$regPath = "HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell"

# Delete the Bags and BagMRU keys if they exist
Remove-Item -Path "$regPath\Bags" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item -Path "$regPath\BagMRU" -Recurse -Force -ErrorAction SilentlyContinue

# Create the Bags key
New-Item -Path $regPath -Name "Bags" -Force

# Create the AllFolders key inside Bags
New-Item -Path "$regPath\Bags" -Name "AllFolders" -Force

# Create the Shell key inside AllFolders
New-Item -Path "$regPath\Bags\AllFolders" -Name "Shell" -Force

# Create the FolderType string value and set its data to NotSpecified
New-ItemProperty -Path "$regPath\Bags\AllFolders\Shell" -Name "FolderType" -PropertyType String -Value "NotSpecified" -Force

Write-Output "Folder discovery has been disabled. Please restart File Explorer to see the changes."

Running the Script

I have published the script on my GitHub repository, so you can clone the repository or download the script file DisableFolderDiscovery.ps1 from there.

1
git clone https://github.com/MagnusJohansson/disable-folder-discovery.git

Open PowerShell as an Administrator.

Navigate to the directory containing the DisableFolderDiscovery.ps1 script.

1
cd path\to\DisableFolderDiscovery

Run the script.

1
./DisableFolderDiscovery.ps1

Restart File Explorer to see the changes.

You can restart File Explorer by opening Task Manager, finding “Windows Explorer” in the list, and clicking “Restart”.

Disclaimer

This script modifies the Windows Registry. It is recommended to back up the relevant registry keys before running the script. Use this script at your own risk. The author is not responsible for any potential damages or issues that may arise from using this script.

Conclusion

By following the steps above, you can disable the folder discovery feature in Windows 11 and enjoy a consistent view in File Explorer. This PowerShell script makes the process straightforward and quick. If you found this post helpful, feel free to share it with others who might benefit from it.

Happy computing!

This post is licensed under CC BY 4.0 by the author.