troubleshooting Question

Exchange Powershell question

Avatar of kiwiziploc
kiwiziploc asked on
ExchangePowershell
3 Comments1 Solution668 ViewsLast Modified:
Running the following script is awesome.....  but how could I get it to give me the default SMTP address for the distribution lists?  

Would like this to be piped to a file, with Distribution list name, members and SMTP address.

$strFilter = "(&(objectCategory=Group)(|(groupType=2)(groupType=4)(groupType=8)))"
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.SearchRoot = $objDomain
$objSearcher.PageSize = 1000
$objSearcher.Filter = $strFilter
$objSearcher.SearchScope = "Subtree"
$objSearcher.PropertiesToLoad.Add("cn") | Out-Null
$objSearcher.PropertiesToLoad.Add("member") | Out-Null  
$colResults = $objSearcher.FindAll()
foreach ($objResult in $colResults){
     $objItem = $objResult.Properties;    
                 foreach ($objMember in $objItem.member) {
                                Write-Output "$($objItem.cn),$($objMember)"    
                }
}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros