Learn Powershell | Achieve More


Home | Pages | Archives


PowerShell V3 CTP 1 released to Windows 7 and Windows 2008R2 and Export-Csv with –Append!

September 19, 2011 8:09 pm

You heard it! PowerShell V3 CTP 1 is out in the wild and ready for downloaded right here!

Bear in mind that this is only for Windows 7 and Windows 2008R2. It does require a reboot to complete the installation but on a good note, you do not have to uninstall anything to get this working. Also required is .NET 4.0 as well.

A couple of great things that I have found now that I can play with this on a Windows 7 machine is that Export-CSV has a –Append parameter!

image

This means we can finally add to an existing csv file as long as the headers are the same.

Get-Process | Export-Csv report.csv -NoTypeInformation
Get-Process | Export-Csv report.csv -NoTypeInformation -append

Great  stuff! Now what happens if we try to use the –append with mis-matched properties?

Get-Process | Export-Csv report.csv -NoTypeInformation
Get-Service | Export-Csv report.csv -NoTypeInformation -Append

image 

You can use the –Force parameter, but understand that you are pretty much ruining the csv for future use.

Get-Process | Export-Csv report.csv -NoTypeInformation
Get-Service | Export-Csv report.csv -NoTypeInformation -append -force
Import-Csv report.csv

 

image

Yea, not so pretty, is it?

So we have a very useful addition to an already great cmdlet, Export-Csv!

So what are you waiting for? Download PowerShell V3 and get to exploring because there is soooo much more to find!

Posted by Boe Prox

Categories: News, powershell

Tags: , , , ,

One Response to “PowerShell V3 CTP 1 released to Windows 7 and Windows 2008R2 and Export-Csv with –Append!”

  1. Checkout this post to see my simple demo on invoke-webrequest. http://www.cachelog.net/powershell-v3-invoke-webrequest/

    By Gino on November 1, 2011 at 1:35 pm

Leave a Reply



Mobile Site | Full Site


Get a free blog at WordPress.com Theme: WordPress Mobile Edition by Alex King.