I want to reindex page library using powershell. I have try with c# code. Code is below.

void Main()
 using (SPSite site = new SPSite("http://demosvr1/web1/"))
 using (SPWeb web = site.OpenWeb())
  SPList docList = web.Lists["Documents"];
  object versionObj = docList.RootFolder.Properties["vti_searchversion"];
  int version = ((versionObj is int) ? ((int) versionObj) : 0); 

  docList.RootFolder.SetProperty("vti_searchversion", (version + 1));

How to do that using powershell ?

1 Answer 1


This should do it:

$w = Get-SPWeb http://demosvr1/web1/
$list = $w.Lists["Documents"]
$versionObj = $list.RootFolder.Properties["vti_searchversion"]
$list.RootFolder.SetProperty("vti_searchversion", ($versionObj + 1));  
  • Hi,this script works fine and it is updating number but when i crawl search it will not display my library in manage catalog connection. If i manually reindex doc library and run search service than it is displaying. Do i missing something? Jan 13, 2014 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.