0

How to find, how to read Windows Indexing Service state (indexing state) from code? OS is Windows Server 2012 R2.

Indexing status

Radek
  • 33
  • 5
  • Can you see message in Event Viewer manually? You can then check the event in code to get status. – jdweng Jan 07 '21 at 14:28
  • No - I don't see this status in Event Log. – Radek Jan 07 '21 at 15:41
  • Try from event utility and see if any thing for INFO is occurring at time you do indexing. See https://www.qualitestgroup.com/resources/knowledge-center/how-to-guide/query-logs-event-viewer-using-command-line/. Once we find it manually then we should attempt to do from c#. – jdweng Jan 07 '21 at 16:20
  • I think what you are seeing in the GUI is the standard output of running the indexing manually. – jdweng Jan 07 '21 at 16:24
  • No - nothing in Event Log. There is something in Indexing Service Reference https://learn.microsoft.com/en-us/previous-versions/windows/desktop/indexsrv/functions but CIState link is dead and I'm not sure how to use Indexing Service functions :( – Radek Jan 08 '21 at 12:19
  • I foundfollowing : https://learn.microsoft.com/en-us/windows/win32/search/-search-3x-wds-qryidx-overview – jdweng Jan 08 '21 at 13:48

1 Answers1

1

This can be done by using Microsoft.Search.Interop witch I get from here: https://www.nuget.org/packages/tlbimp-Microsoft.Search.Interop/

Then it is easy using documentation from: https://learn.microsoft.com/en-us/windows/win32/api/searchapi/ne-searchapi-catalogstatus to get indexing status.

    Dim status As _CatalogStatus
    Dim reason As _CatalogPausedReason
    Dim manager As CSearchManager = New CSearchManager()
    Dim catalogManager As ISearchCatalogManager = manager.GetCatalog("SystemIndex")
    catalogManager.GetCatalogStatus(status, reason)

All I did on Windows Server 2012 R2.

Radek
  • 33
  • 5