$File = “C:\ita\groupslog.txt”
Get-DistributionGroup | select name , alias ,displayname,EmailAddresses | foreach {
“Name: “+$_.name
“Alias: “+$_.alias
“Displayname“ +$_.displayname
$_.EmailAddresses | foreach {
if($_.SmtpAddress){
“SmtpAddress: “+$_.SmtpAddress
}
}
} | out-File $File