Radek
Radek

Reputation: 33

How to get Windows Indexing Service state from code?

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

Indexing status

Upvotes: 0

Views: 399

Answers (1)

Radek
Radek

Reputation: 33

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.

Upvotes: 1

Related Questions