am trying to ReIndex a custom splist using powershell [ src link : reindex-pages-lib

   add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction

      $SiteURL = "http://server001:28516/"
       $ListName =  "Risk and Issue Log Tracker"  
      $w = Get-SPWeb $SiteURL
        $list = $w.Lists[$ListName]
        $versionObj = $list.RootFolder.Properties["vti_searchversion"]
        ($versionObj + 1));  

but it throws me error:

Some error occured. Object reference not set to an instance of an object.

under what n whic circumstances it will throw errors? when I tried with all the other docu libs and splists, i didnt get this error.

This is happening only for this list!


1 Answer 1


Open the list by browsing to it with your browser and compare the name of the list to the url. Use what is in the url for $listName = "What is in the browser"

So if the browser says http://server001:28516/lists/what%20is%20list, you wouldnt use $listName = "What is in the browser" but instead you would use $listName = "What is list"

The reason for this is when a list gets created the name used is what is hard coded into the URL. Then if business decides they don't like that name, then the name is changed, but the initial url remains. This might be what happened here.

Hope this helps

See if $w.lists | ft title, nocrawl shows that the list is marked to not allow indexing, if the nocrawl property is true.

  • i think, you are correct, they changed the name of list after creating the same.Lemme follow your suggestions n revert here. I think you are talking about the internal name of the list. its RILT , NOT THE one i have mentioned in the $listname variable. But when i tried with the RILT as $list name it throws another error: You cannot call a method on a null-valued expression. At E:\PoCSolutions\ReindexDocLibsNPD.ps1:13 char:1 + $list.Update();
    – samolpp2
    Jun 17, 2017 at 20:57
  • is RILT what shows in the browser?
    – Stacy
    Jun 17, 2017 at 21:03
  • Yes, this is the url : server001:28516/Lists/RILT/NewView.aspx
    – samolpp2
    Jun 17, 2017 at 21:04
  • try stepping through you ps1. run the line that get-spweb server001:28516 and then instantiate that into the $w, then see what or if $w.lists returns for the RILT list.
    – Stacy
    Jun 17, 2017 at 21:10
  • I HAVE UPDATED the question with the screenshot. one more question, how will i come to know, the SPSLIST is corrupted?
    – samolpp2
    Jun 17, 2017 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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