1

I'm looking for a way to disable new lists and libraries from being searchable. Ultimately, this site will be public facing and even though I can tell people to remember to disable lists and libraries when they are created, it's not realistic that this will happen. I don't want all of them disabled, but just lists that explicitly turned on.

I could swear I did this with powershell on a previous site, defaulting $list.NoCrawl = $true but I can't remember how.

4 Answers 4

2

Another alternative is to create a Result Source for Search so that it only presents the data you want to present in search. That way you don't have to go and disable it all the time. You control how search returns results rather than try to manage your users.

1

You can create a SPListEventReceiver.ListAdded event receiver and write code inside it to disable list crawling.

0

Did you try this.

 $site = Get-SPSite http://siteColl  
$site | Get-SPWeb -Limit ALL | ForEach-Object {   
    foreach ($list in $_.lists) 
    {                  
                $list.NoCrawl = $true
                $list.Update()
    }
}
$site.Dispose()
3
  • I think this takes all current lists and sets the nocrawl property so they aren't searchable. This won't address future lists, which is really what my intention is.
    – CeeMoney
    Commented May 29, 2014 at 4:09
  • i am thinking a different approach...you need to tweak this script little bit and then run this as a schedule task Daily or weekly depend upon requirement(or list creation). it will check required lists if search enable then disable it....issue is may be some enable search on old list accidentally...just a thought.
    – Waqas Sarwar MVP
    Commented May 29, 2014 at 4:18
  • Hmmm.... this approach might work.
    – CeeMoney
    Commented May 29, 2014 at 8:52
-1
Get-SPSite $siteUrl | Get-SPWeb -Limit all | ForEach-Object {

     Write-Host "`tProcessing Web: $($_.ServerRelativeUrl)…" -ForegroundColor White

     if (!$whatIf)    
     {    
         Write-Host "Setting properties on Web:" $_.Title -ForegroundColor White

         $_.NoCrawl = $true    
         #Update the web   
         $_.Update()    
     }    
     else    
     {    
         Write-Host "Reading properties on Web:" $_.Title -ForegroundColor White    
         Write-Host "No crawl enabled: "$_.NoCrawl

     }    
 }

 $site.Dispose()
1
  • Same script was posted a while ago. Some variables are undefined as well. Commented Sep 22, 2015 at 10:19

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.