Here's something that I wrote in PowerShell that should work for what you need. It needs some cleanup, but give you a good bit of groundwork for what will be needed.
$Server="${IP}"# From Orion SAM Variables
$PathToFiles="\C$\Intel\Logs"
$SearchPattern="*.AML.log"
$Path=Join-Path-Path"\\$Server"-ChildPath$PathToFiles
$FileCount= ( [System.IO.Directory]::EnumerateFiles($Path,$SearchPattern) |Measure-Object ).Count
Write-Host"Message: $FileCount files exist in ""$Path"" matching pattern ""$SearchPattern"""
Write-Host"Statistic: $FileCount"
exit0
You can also use the $PathToFiles and the $SearchPattern as parameters in the Component Template.
--KMSigma