We have a document library which contains multiple document set we have below requirements :

  1. Get all document set properties like Name, Created Date, Modified date.
  2. Get all ItemChild (document present inside the document set) properties Name, Created Date, Modified date.

We are able to get document set properties but unable to get ItemChild properties, any lead much appreciated, Please find my below code.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

$web = Get-SPWeb "Site URL"

$list = $web.Lists["ENERGY"]

foreach ($listItem in $list.Items)
$CabinetName = $listItem['Name']
$CabinetCreateDate = $listItem['Created']
$CabinetModifiedDate = $listItem['Modified']
$CabinetChildItemCount = $listItem['ItemChildCount']

   Write-Host "    Cabinet Name: " $listItem.Name "  Modified: " $CabinetModifiedDate "Cabinet ChildItem Count" $CabinetChildItemCount "Created Date:" $CabinetCreateDate

$web.Dispose ()
  • $folders = $list.RootFolder.Subfolders foreach ($folder in $folders) { $CabinetName = $folder.Name $CabinetItemCount = $folder.ItemCount $folderItems = $folder.Item Write-Host "Cabinet Name:" $CabinetName "Cabinet Item count:" $CabinetItemCount } May 29, 2020 at 20:05
  • Tried with this... It's working but not getting child item properties May 29, 2020 at 20:06

1 Answer 1


I have prepared a script and tested it. Please make changes in case you don't want anything. it's giving correct output.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"

# Enter site URL for which reports needs to be generated 
$web = Get-SPWeb " "

#Enter List/Document Library name
$list = $web.Lists["UW_ENERGY"]

#Enter local machine path where you want generate report
$path ="C:\Users\Desktop\Sachin\May2020\"

$resultantfile = $path +"CompleteReport.csv"

Add-Content -Path $resultantfile -Value "Cabinet URL|CabinetFileName|CreatedDate|ModifiedDate|Document Count|Type"

# Variable used for split the URL
$separator = "/"

foreach($item in $list.items)

            $ItemURL = $item.Url
            $ItemName = $item.Name
            $ItemCreatedDate = $item['Created'] 
            $ItemModifiedDate = $item['Modified']

            $DocuemntSet = $ItemURL.split($separator)

            if($DocuemntSet[2] -eq $ItemName )

             $ItemChildCount = $item['ItemChildCount']
             $Doctype = "Cabinet"
            $Doctype = "Child Item"
            $ItemChildCount = " "

             write-host "Item URL:" $ItemURL "Item Name:" $ItemName "Item Create Date:"$ItemCreatedDate "Item Modified Date:"$ItemModifiedDate "Item Child Count:"$ItemChildCount "Type:"$Doctype

             $content = $ItemURL+"|"+$ItemName+"|" +$ItemCreatedDate+"|"+$ItemModifiedDate+"|" +$ItemChildCount +"|" +$Doctype +"|"                      
             Add-Content -Path $resultantfile -Value $content



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.