How to get the property for getting "Show items inside folders" within a document library's advanced settings using PowerShell script.I am having 3 folders and I do not want these folders to be seen in the view.So I want to hide this.Manually I went to the settings and I am changing the "show items inside folders" option. But I have some 100 plus sub sites and each sub site has 8 libraries.

    $mysiteurl = "http://server1:123/sites/mysiteURL"
    $msitee = Get-SPSite $mysiteurl
    #web =  $msitee.Rootweb
      foreach($list in $web.Lists) 
        if($list.BaseType -eq  "DocumentLibrary") 
           $items = $mlist.items
        foreach ($item in $items)

1 Answer 1


You should change default view property like:

$web = Get-SPWeb "http://test.com"
$doclib = $web.Lists["Shared Documents"]
$view = $doclib.Views["All Documents"]
$view.Scope = [Microsoft.SharePoint.SPViewScope]::Recursive

Where "http://test.com" - site URL, "Shared Documents" - name of list/library, "All Documents" - default view name.

  • Spot on answer. I just think your bold text has mangled the display with extraneous tags.
    – Bunzab
    Commented May 25, 2015 at 18:28

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.