reset search index all crawled content source in sharepoint 2019 powershell

reset search index in sharepoint 2019 for all crawled content source is a critical task. You know there are 6 search components like crawl component,content processing component,analytics processing component, index component, query processing component, search administration component in search topology. When user query something, results retrieving from index files. Administrator adds content source, crawling happens, indexing happening. In case of corrupt index , status of index component is degraded, search result not coming, sharepoint index partition yellow triangle appears, we have to perform this activity. We can follow UI method from search administration page for index reset but timeout error might come. We can use powershell command to clear indexed results for all crawled content source.

Advertisements

Pre-Index Reset Task

Before doing index reset, make sure below check points satisfying

  • Crawl status for content source is idle.
  • Crawler background activity status is none.
  • Disable crawl schedule otherwise. recent crawl rate should be 0 items per second.
  • Recent query rate should be 0 queries per minute
  • Administrative status should not be running. Suspend search service application if its running mode by running beow command.
Suspend-SPEnterpriseSearchServiceApplication "Search Service Application"
Advertisements
suspend search service application
crawl status is idle
crawl status disabled
Advertisements

Navigate to manage service application from central administrator in sharepoint 2019. Click on search service application, you will be redirected to search service application administrator page. validate the pre-index reset task checks.

index reset task search administration

After that, its good to proceed for reset indexing in sharepoint search.

Advertisements

Index Reset Task

We can do this by UI method or by using powershell command. let’s underatand both methos.

UI method from Search Administration Page

click on “Index reset” from left navigation.

index reset tasak search administration sharepoint 2019
Advertisements

Deactivate search alerts by selecting the checkbox to stop alerts. Its very important to diable alerts without any miss and click on “Reset Now” from searchreset page.

reset now
Advertisements

index files will be cleared, once process completed. Click on “Crawl log” and you will find last crawl field reset to “No data”. Crawl properties like successes, warnings, errors, top level errors, deletes reset to “0”.

crawl log in sharepoint server 2019

search index reset timeout might come in UI method, so better to use powershell command method.

Advertisements

Powershell command to reset search index

We can use powershell command to delete search index files for all crawled content source. Find below the powershell command.

(Get-SPEnterpriseSearchServiceApplication).reset($true, $true)
# $True: Disable Alerts and Ignore Timeout error
search index reset using powershell in sharepoint 2019 on-premises
Advertisements

Post-Index Reset Task

After clearing or resetting search index, always have to start full crawl for the content source. Click on “Content sources” from left navigation. Click on the drop down option for the content source and select “Start Full Crawl”

start full crawl content sources search in sharepoint server 2019

follow the vide below, to know step by step procedure in video format for better understanding.

Advertisements
Advertisements
Advertisements

uls logs fiddler traces verbose logging collect

collect and analyze uls logs fiddler traces verbose logging enabled is one of the most common sharepoint administrator task. If there is an issue in accessing site, webpart in sharepoint page, data source connection, application, we can follow this . We collect uls logs, capture fiddler traces by enabling verbose logging. In this post I will share the step by step process to enable verbose using powershell, debug or capture fillder trace or https traffic.

Advertisements

we need to follow these steps as below:

  • Run fiddler
  • Enable verbose logging in sharepoint server
  • Create new log file in sharepoint server.
  • Access the site having issue
  • Create log files new.
  • Disable verbose logging.
  • save fiddler trace all session
Advertisements

collect uls logs fiddler traces verbose step by step

  • Close all browsers.
  • Run fiddler to collect fiddler trace or capture https traffic.
  • Run sharepoint management shell as an administrator.
  • Enable verbose logging applying powershell command below.
Set-SPLogLevel -TraceSeverity VerboseEx
Advertisements
  • collect uls logs, new log file running below command in all sharepoint servers
New-SPLogFile
Advertisements
  • Remove all sessions from fiddler.
  • Access sharepoint site now.
  • Run below command in sharepoint management shell in all sharepoint servers.
New-SPLogFile
Advertisements
  • Disable verbose now by running command below.
Clear-SPLogLevel
uls logs fiddler traces verbose logging
Advertisements
  • Save the fiddler trace results.
File -> Save -> All Session

You can follow the post “Log management using powershell” to get more details about management of uls logs in sharepoint 2019.

Advertisements

Follow the video to get steps in detail for better understanding.

Advertisements

kill windows service stuck at stopping

Every infracture admin need to know the steps to force stop or kill windows service stuck at stopping by pid using taskkill or powershell. Think about a situation, you are trying to stop a windows service but its stuck at stopping status. Means service stopping hung and not responding. In this case we need to force kill windows service either by using taskkill in command line (cmd) or by powershell. Follow the step by step commands to apply in cmd for force stop service windows server.

Advertisements

Run command prompt as an administrator and type taskkill help command as below. That will display parameter list like /S, /U, /P, /FI, /PID, /IM, /T, /F, /? and why these are used. You will find these parameters in the commands below.

Advertisements

kill windows service command line

taskkill /?
kill windows service using taskkill windows command line
kill windows service using taskkill windows command line
Advertisements
kill process id using taskkill windows command line
kill process id using taskkill windows command line
Advertisements

First step is to identify the “Service name” of windows service stuck at stopping. Let’s say windows update service stuck at stopping, then right click on the service and click on properties will show you the service name “wuauserv”. Alterenatively, you can run powershell command “Get-Service” to get windows service details. Run the below command in command prompt to get the PID of service.

sc queryex <service name>
sc queryex wuauserv
windows service properties service  name
windows service properties service name
Advertisements
sc queryex wuauserv
sc queryex wuauserv

You can check the PID in “Task manager” under the the tab “Services”.

PID in Task manager
PID in Task manager
Advertisements

Next step is to kill windows service PID running below cmd in command prompt.

taskkill /f /pid [PID]
taskkill /f /pid 996
taskkill /f /pid
taskkill /f /pid
Advertisements

You will find the service is stopped after applying the command above. You can disable the serivce else apply the state as per your requirement.

windows update service stopped how to disable
windows update service stopped how to disable
Advertisements

You can kill processes from command prompt without knowing the PID by running the below command.

taskkill /F /FI "SERVICES eq wuauserv"
taskkill /F /FI "SERVICES eq wuauserv"
taskkill /F /FI “SERVICES eq wuauserv”
Advertisements

You can force stop a service running with particular user id using below cmd.

taskkill /F /FI "USERNAME eq Deviprasad"

cmd to task kill all windows services not respnding running as below.

taskkill /F /FI "status eq not responding"
Advertisements

You can kill services consuming more then a limit of memory usage following the command below.

taskkill /FI "memusage gt value"
taskkill /FI "memusage gt 220600"
kill pid memusage gt
kill pid memusage gt
kill service memusage gt
kill service memusage gt
Advertisements

Run the cmd as below to get list of tasks running in server.

tasklist
tasklist
tasklist
Advertisements

we can run the below cmd to kill task running in the server.

taskkill /F /IM taskmgr.exe
taskkill /F /IM taskmgr.exe
taskkill /F /IM taskmgr.exe
Advertisements

End task using powershell

We can use below powershell commands to kill windows service.

Stop-Process -ID ProcessID - Force
Stop-Process -ID 6196 - Force
Stop-Process -Name ProcessName -Force
Stop-Process -Name iexplorer -Force
kill service or pid usinf powershell
kill service or pid usinf powershell
Advertisements

powershell command to force kill services not responding.

Get-WmiObject -Class win32_service | Where-Object {$_.state -eq 'stop pending'}
Advertisements

Watch the video to get details step by step for better understanding.

Advertisements