I am pulling a list of all .csv files in a folder, and trying to use a foreach loop to display each .csv file in a separate row in a UDGrid. I am running into trouble with the Endpoint when importing the csv. Is there an easy way to do this?
My code:
$trustList = Get-ChildItem -Path $path -Recurse -Filter “Domain_Trusts_*”
$CountTrust = $trustList.count
foreach ($trust in $trustlist <#| Select -first 1#>)
{
$temp1 = $trust.name
$temp2 = ($temp1.split("_"))[2]
$trustName = $temp2.substring(0,$temp2.Lastindexof('.'))
$Filepath = $path+$temp1
New-UDRow -columns{
New-UDColumn -SmallSize 12 -Content {
New-UDGrid -Title $trustName -Headers @("Domain Source","Target","Direction","Trust Type","Forest Transitive","Intra Forest","Is Tree Parent","Is Tree Root","Selective Authentication","Sid Filtering Forest Aware","Sid Filtering Quarantined","Disallow Transivity","Trust Attributes") -Properties @("DomainSource","Target","Direction","TrustType","ForestTransitive","IntraForest","IsTreeParent","IsTreeRoot","SelectiveAuthentication","SidFilteringForestAware","SidFilteringQuarantined","DisallowTransivity","TrustAttributes") -AutoRefresh -RefreshInterval 60 -Endpoint {
($temp1 = Import-CSV $filepath) | Sort-Object -Property "Domain Source" | Select * | Out-UDGridData
} ##End New-UDGrid
} ## End New-UDColumn
} ## End New-UDRow two
} ## End for-each