PsCustomObject into CSV

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Jarek C. Jarek C. 3 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #44920
    Profile photo of Jarek C.
    Jarek C.
    Participant

    I have a number of server scan results in a custom object properties like some file paths, local groups. Problem is when I try to export to csv some note properties e.g. file paths get cut and my local groups get only first line in the csv. As an example I have a Custom Object called $report with note properties scheduled_task_action C:\Program Files\ABC\test.exe C:\Program Files\ABC\test.xml where after exporting to csv I see only C:\Program Files\A
    or in my local_admins list property :
    adminsitartor;
    domain\user1;
    domain\user2,
    ...
    I only get administrator. All the note properties are strings. I export with
    $report | select scheduled_task_action, local_admins | Export-CSV .\test.csv -force -encoding UTF8 -NoTypeInformation
    How can this be fixed so the whole properties show up when I open the csv in Execl?

    #44924
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Depends on what's in the objects you're exporting to a CSV. Also, in Excel, you may need to change your column height / row width in order to see all of the information that's available in each cell.

    #44926
    Profile photo of Jarek C.
    Jarek C.
    Participant

    You're right. I incorrectly assumed that export-csv will add comas where needed yet looking at the resulting csv in notepad it seems it's not the case so need to sort out my formatting.
    I noticed that for some reason in the resulting csv I get end of line followed by "," in the line below which messes up the csv
    e.g.
    "scheduled_task_action","c:\test.exe c:\test.xml
    ","scheduled_task_name"
    ","....
    what coule be the reason for that?

    • This reply was modified 3 months ago by Profile photo of Jarek C. Jarek C..
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.