05 May,2012 by Tom Collins
Question: How can I export a Powershell recordset to a CSV file format, so I can then open the file in MS Excel?
Answer: Powershell has the Export-CSV cmdlet . The Export-CSV cmdlet creates a CSV file of the script output. The script needs to pipe the results to the Export-CSV cmdlet – with a filename parameter.
I add –notype to the Export-CSV cmdlet , as I prefer to not include the .Net object type in the first line
Get-Process | Where-Object {$_.PrivateMemorySize -gt 100MB} | SELECT ProcessName, PrivateMemorySize | Export-CSV -notype c:\privatememory.csv
This is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
Posted by: |