How to Reset Windows Search in Windows 10  

    How to Reset Windows Search in Windows 10

    How to Reset Windows Search in Windows 10

    Published by Category: Performance & Maintenance
    08 Mar 2024
    Designer Media Ltd

    How to Reset Windows Search in Windows 10


    Search Windows and the web from the taskbar to find help, apps, files, settings—you name it. You can also get quick answers from the web—like weather, stock prices, currency conversion, and much more—and get to websites faster by using links in the preview pane.

    Windows Search is a desktop search platform that has instant search capabilities for most common file and data types such as email, contacts, calendar appointments, documents, photos, multimedia, and other formats that can be extended by third party developers. These capabilities enable users to find, manage, and organize the increasing amount of data common in home and enterprise environments.

    If Windows Search is unresponsive and not working, you can try resetting Windows Search to fix problems with it.

    See also:

    This tutorial will show you how to reset Windows Search in Windows 10.

    Resetting Windows Search does not affect your files. However, it may temporarily affect the relevance of search results.

    You must be signed in as an administrator to reset Windows Search.



    Here's How:

    1 Download the ResetWindowsSearchBox.ps1 file from Microsoft at the link below. (see screenshot below)

    Reset Windows Search PowerShell script | Microsoft Download Center

    Download

    How to Reset Windows Search in Windows 10-download.png

    (contents of ResetWindowsSearchBox.ps1 file for reference)
    Code:
    # Copyright © 2019, Microsoft Corporation. All rights reserved.
    
    function T-R
    {
        [CmdletBinding()]
        Param(
            [String] $n
        )
    
        $o = Get-Item -LiteralPath $n -ErrorAction SilentlyContinue
        return ($o -ne $null)
    }
    
    function R-R
    {
        [CmdletBinding()]
        Param(
            [String] $l
        )
    
        $m = T-R $l
        if ($m) {
            Remove-Item -Path $l -Recurse -ErrorAction SilentlyContinue
        }
    }
    
    function S-D {
        R-R "HKLM:\SOFTWARE\Microsoft\Cortana\Testability"
        R-R "HKLM:\SOFTWARE\Microsoft\Search\Testability"
    }
    
    function K-P {
        [CmdletBinding()]
        Param(
            [String] $g
        )
    
        $h = Get-Process $g -ErrorAction SilentlyContinue
    
        $i = $(get-date).AddSeconds(2)
        $k = $(get-date)
    
        while ((($i - $k) -gt 0) -and $h) {
            $k = $(get-date)
    
            $h = Get-Process $g -ErrorAction SilentlyContinue
            if ($h) {
                $h.CloseMainWindow() | Out-Null
                Stop-Process -Id $h.Id -Force
            }
    
            $h = Get-Process $g -ErrorAction SilentlyContinue
        }
    }
    
    function D-FF {
        [CmdletBinding()]
        Param(
            [string[]] $e
        )
    
        foreach ($f in $e) {
            if (Test-Path -Path $f) {
                Remove-Item -Recurse -Force $f -ErrorAction SilentlyContinue
            }
        }
    }
    
    function D-W {
    
        $d = @("$Env:localappdata\Packages\Microsoft.Cortana_8wekyb3d8bbwe\AC\AppCache",
            "$Env:localappdata\Packages\Microsoft.Cortana_8wekyb3d8bbwe\AC\INetCache",
            "$Env:localappdata\Packages\Microsoft.Cortana_8wekyb3d8bbwe\AC\INetCookies",
            "$Env:localappdata\Packages\Microsoft.Cortana_8wekyb3d8bbwe\AC\INetHistory",
            "$Env:localappdata\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy\AC\AppCache",
            "$Env:localappdata\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy\AC\INetCache",
            "$Env:localappdata\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy\AC\INetCookies",
            "$Env:localappdata\Packages\Microsoft.Windows.Cortana_cw5n1h2txyewy\AC\INetHistory",
            "$Env:localappdata\Packages\Microsoft.Search_8wekyb3d8bbwe\AC\AppCache",
            "$Env:localappdata\Packages\Microsoft.Search_8wekyb3d8bbwe\AC\INetCache",
            "$Env:localappdata\Packages\Microsoft.Search_8wekyb3d8bbwe\AC\INetCookies",
            "$Env:localappdata\Packages\Microsoft.Search_8wekyb3d8bbwe\AC\INetHistory",
            "$Env:localappdata\Packages\Microsoft.Windows.Search_cw5n1h2txyewy\AC\AppCache",
            "$Env:localappdata\Packages\Microsoft.Windows.Search_cw5n1h2txyewy\AC\INetCache",
            "$Env:localappdata\Packages\Microsoft.Windows.Search_cw5n1h2txyewy\AC\INetCookies",
            "$Env:localappdata\Packages\Microsoft.Windows.Search_cw5n1h2txyewy\AC\INetHistory")
    
        D-FF $d
    }
    
    function R-L {
        [CmdletBinding()]
        Param(
            [String] $c
        )
     
        K-P $c 2>&1 | out-null
        D-W # 2>&1 | out-null
        K-P $c 2>&1 | out-null
    
        Start-Sleep -s 5
    }
    
    function D-E {
        Write-Host "Press any key to continue..."
        $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyUp") > $null
    }
    
    Write-Output "Verifying that the script is running elevated"
    if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
     if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
      $Cx = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
      Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList "-noexit",$Cx
      Exit
     }
    }
    
    $a = "searchui"
    $b = "$Env:localappdata\Packages\Microsoft.Windows.Search_cw5n1h2txyewy"
    if (Test-Path -Path $b) {
        $a = "searchapp"
    } 
    
    
    Write-Output "Resetting Windows Search Box"
    S-D 2>&1 | out-null
    R-L $a
    
    Write-Output "Done..."
    D-E

    2 Save the ResetWindowsSearchBox.ps1 file to your desktop.

    3 Unblock the ResetWindowsSearchBox.ps1 file. (see screenshot below)

    How to Reset Windows Search in Windows 10-unblock.png

    4 Open an elevated Windows PowerShell or elevated command prompt.

    5 Type the command below into the elevated Windows PowerShell or elevated command prompt, and press Enter. (see screenshots below)

    PowerShell -ExecutionPolicy Unrestricted -File "<Full path of ResetWindowsSearchBox.ps1 file>"

    Substitute <Full path of ResetWindowsSearchBox.ps1 file> in the command above with the actual full path of the ResetWindowsSearchBox.ps1 file (ex: "C:\Users\Brink\Desktop\ResetWindowsSearchBox.ps1").

    For example: PowerShell -ExecutionPolicy Unrestricted -File "C:\Users\Brink\Desktop\ResetWindowsSearchBox.ps1"


    6 When the script is Done, you can close the elevated Windows PowerShell or elevated command prompt window.

    How to Reset Windows Search in Windows 10-reset_windows_search_script.png
    How to Reset Windows Search in Windows 10-reset_windows_search_command.png


    That's it,
    Shawn Brink






  1. Posts : 42,734
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #1

    Hi Shawn, noting this refers extensively to Cortana, is it still valid for 20H2?
    Thanks.
      My Computers


  2. Posts : 68,663
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    dalchina said:
    Hi Shawn, noting this refers extensively to Cortana, is it still valid for 20H2?
    Thanks.
    Hello mate,

    It should still work with 20H2. The script appears to re-register and reset both Cortana and Windows Search.
      My Computers


  3. Posts : 364
    Windows 10
       #3

    Hi Shawn,

    I was working on a customer on Windows 11. I suspect the script is useless in 11 because the in Local Packages, the following folder does not exist:

    Microsoft.Search_8wekyb3d8bbwe\

    I suspect the new is location is %localappdata%\packages\MicrosoftWindows.Client.CBS_cw5n1h2txyewy

    Can you confirm?

    Thanks.
      My Computer


  4. Posts : 68,663
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #4

    Sumit Dhiman said:
    Hi Shawn,

    I was working on a customer on Windows 11. I suspect the script is useless in 11 because the in Local Packages, the following folder does not exist:

    Microsoft.Search_8wekyb3d8bbwe\

    I suspect the new is location is %localappdata%\packages\MicrosoftWindows.Client.CBS_cw5n1h2txyewy

    Can you confirm?

    Thanks.
    Hello Sumit,

    I can confirm seeing the same on my Windows 11.

    How to Reset Windows Search in Windows 10-search.jpg
      My Computers


 

Tutorial Categories

How to Reset Windows Search in Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 14:31.
Find Us




Windows 10 Forums