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

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!

About Boe Prox

Microsoft Cloud and Datacenter MVP working as a SQL DBA.
This entry was posted in News, powershell and tagged , , , , . Bookmark the permalink.

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

  1. Gino says:

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s