Array and export to CSV file

by May 23, 2014


I have data look like this:

ServerName    AppName   Status

—————    ————    ——–

Server_1         VLC Player   Installed

Server_1         IE v8            Installed

Server_2         VLC Player   Installed

                       IE v8            Installed

how can I out put it to a csv file so that it has a header and data looks like this:

ServerName   AppName   Status

Server_1        VLC Player  Installed

                       IE v8          Installed

Server_2        VLC Player  Installed

                       IE v8          Installed


could you please help me with that.  Obviously I am trying to report the internal install app packages which is under a customised registry key so I need to export a csv file which has the server name and a list of installed packages.

I managed to do it ok for a server with a single installed packages but when I have a server with multiple apps, it puts all the installed app into one variable and hence I am stuck.