PowerShell script to export a list to a CSV file

At home I use a SharePoint list as my primary address book (mainly to store addresses for family and friends).  While building a custom backup script in PowerShell I added the following to export my Address Book list to a CSV file:

$AddressBookFile = “E:\Backup\addressbook.csv”
$Web = Get-SPWeb -Identity “http://portal.webbworld.local”
$List = $Web.Lists[“Address Book”]
$ListItemCollection = @()
$List.Items | foreach {
$ExportItem = New-Object PSObject
$ExportItem | Add-Member -MemberType NoteProperty -Name “Name” -Value $_[“Last Name”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “First Name” -Value $_[“First Name”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “Home Phone” -Value $_[“Home Phone”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “Email Address” -Value $_[“Email Address”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “Address” -Value $_[“Address”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “City” -Value $_[“City”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “State/Province” -Value $_[“State/Province”]
$ExportItem | Add-Member -MemberType NoteProperty -Name “ZIP/Postal Code” -Value $_[“ZIP/Postal Code”]
$ListItemCollection += $ExportItem}
$ListItemCollection | Export-CSV $AddressBookFile -NoTypeInformation
$Web.Dispose()

[BlogBookmark] [Blogsvine] [del.icio.us] [Digg] [Facebook] [Furl] [Google] [LinkedIn] [MySpace] [Reddit] [Slashdot] [StumbleUpon] [Twitter] [Windows Live] [Yahoo!] [Email]