I need to write a quick powershell script to do the following agains SP 2007

  1. Show all the folders within a document library.
  2. Count the documents within each folder.
  3. Show the permissions on each folder within the document library.

Anyone got any ideas on how to do this?

  • Any ideas to get this working ? Commented Aug 5, 2016 at 13:52
  • $site = new-object Microsoft.SharePoint.SPSite("wss/sites/Jamaame") $web = $site.rootweb $list = $web.Lists["Champa"] $foldercount = $list.Folders.Count foreach ($listItem in $list.Folders) { write-host ($listItem.Name) } Commented Aug 5, 2016 at 13:53
  • I have this , that I have written but it only shows the root folders , I need to find the amount of files within each root folder and the perms on them Commented Aug 5, 2016 at 13:54

1 Answer 1

$StartingFolder = "\\sharepointportal\site\subsite"
$FolderList = gci $StartingFolder -recurse | ?{$_.psiscontainer}
foreach ($Folder in $FolderList){

          foreach($item in $folder)
"Folder: $($Folder.fullname) Count: $Count"

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.