How do I prevent my program’s temporary documents from appearing in Search?

Raymond Chen

Raymond

A customer wanted to know how to disable Cortana and Search completely on their employees’s systems. “A user should not be able to search for anything from anywhere.”

That seems a rather broad statement. But what is the problem that they think disabling Cortana and Search will solve? In many cases, a customer asks for a way to hide something when in fact they really want to disable it. What is the thing they specifically want to prevent the user from searching for?

The customer explained that their program creates some files which are required for proper functioning, but they don’t want the user to be able to search for and find those files. Users should be using the program to manage those files. The customer cannot block access to the files because their program needs them to function. The customer understands that a technically adept user will be able to find the files even when hidden them from search, but that’s okay. They just don’t want the files to distract casual users.

Consider a program which creates some Excel spreadsheets to assist with its calculations. If those Excel spreadsheets showed up in searches, then users would be tempted to open those Excel spreadsheets and start messing with them, which would confuse the program.

What the program should do is create those internal Excel spreadsheets in the Application Data directory, rather than in the Documents directory.

If that’s not possible, it could at least mark the files as hidden. That would also remove it from search results.

These solutions avoid using a global solution to a local problem. It seems awfully presumptuous for a program to take it upon itself to disable searching outright, just because it wants to keep its own private files hidden. It’s like cutting power to the entire house to make sure nobody watches television.

Bonus chatter: There are quite a few group policies in Computer Configuration\Administrative Templates\Windows Components\Search for controlling what shows up in the search index. For eaxmple, you can exclude specific directories from search, or exclude a list of file types.

Raymond Chen
Raymond Chen

Follow Raymond