I have this code that I am running from powershell. When I run it without the export-csv i get all the folder names on the screen.
dir | select -expand fulln
This is another way to handle this issue:
Define the master array list
$MASTER_ARRAY_LIST = [System.Collections.ArrayList]@()
Define the output filename
$OutputFilename="C:\TEMP\MyOutputFile.csv"
ForEach ( $Something in $List_of_Somethings) {
$CURRENT_RECORD_DETAILS = New-Object PSObject -Property @{'name'=$($Something.Name);'fullname'=$($Something.FullName);'id'=$($Something.ID)}
$MASTER_ARRAY_LIST.Add( $CURRENT_RECORD_DETAILS ) > $null
}
$MASTER_ARRAY_LIST.ToArray() | Select-Object -Property name,fullname,id | Export-Csv -Path $OutputFilename -NoTypeInformation