Submitted By: Kent Finkle

List all the members of an Outlook distribution list.

PowerShell
Edit|Remove
$comments = @'
Script name: List-Distribution.ps1
Created on: Saturday, August 11, 2007
Author: Kent Finkle
Purpose: How can I use Windows Powershell to
List All the Members of a Microsoft Outlook Distribution List?
'@
 
$olFolderContacts = 10
 
$o = new-object -comobject outlook.application 
$n = $o.GetNamespace("MAPI") 
$f = $n.GetDefaultFolder($olFolderContacts).Items
 
$Vendors = $f.Item("Approved Vendors")
 
for ($i = 1; $i -le $Vendors.MemberCount; $i++) { 
    $Vendor = $Vendors.GetMember($i)
    Write-Host($Vendor.Name + ", " + $Vendor.Address)
}