Using Powershell Core Service module we can fetch list of components under folder, here is powerhshell function whcih can be used to fetch components under tridion folder
function GetComponentsFromFolder{param([string]$folderItem,[int]$indentDepth = 0)Begin{$tcmClient = Get-TridionCoreServiceClient -Verbose:($PSBoundParameters['Verbose'] -eq $true);}Process{write-host "in GetComponentsFromFolder with " + $folderItem
$groupFilter = New-Object Tridion.ContentManager.CoreService.Client.OrganizationalItemItemsFilterData$itemList = New-Object System.Collections.ArrayList($null);# For each item nested in the passed folder item, find item type. If item is another folder item, recurively loop through the new folder item.foreach ($element in $tcmClient.GetListXml($folderItem, $groupFilter).Nodes()){
$elementId = $element.Attribute("ID").Value$elementTitle = $element.Attribute("Title").Value$elementType = $element.Attribute("Type").Value$elementSchema = $element.Attribute("SchemaId").Valueswitch ($elementType){# Folder"2"{# Send folder back through GetComponentsFromFolder$lst = GetComponentsFromFolder -folderItem $elementId -indentDepth $indentDepth + 1if($null -ne $lst){if($lst.GetType().Name -eq "String"){[void]$itemList.Add($lst);}else{[void]$itemList.AddRange($lst);}}}
# Component"16"{[void]$itemList.Add($elementId)}
}}return $itemList;}
End{Close-TridionCoreServiceClient $tcmClient;}}
and here how we can call the function on command line
PS> GetComponentsFromFolder -folderItem "tcm:5-2341-2"
Translate