Get DG with emailaddress
Hello,
I run the below command in Exchange 2007:
foreach ($dl in get-distributiongroup) {if ((get-distributiongroupmember $dl |% {$_.samaccountname}) -contains"Graig"){$dl.name}}
I would need to obtan the same result but I would need name of DG the identity GRAIG belongs to BUT I would like to have the primary email address of the DGs as well.
I tried to just change {$dl.name} by {$dl.PrimarySmtpAddress} but it does not give me the PrimarySmtpAddress nicely :s
November 5th, 2010 2:12pm
Any better?
foreach ($dg in get-distributiongroup -resultsize unlimited) {if ((get-distributiongroupmember $dg |% {$_.samaccountname}) -contains "Graig") {$dg | select name,primarysmtpaddress}}[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Free Windows Admin Tool Kit Click here and download it now
November 5th, 2010 4:31pm