1 2 3 4 5 6 7 8 9 10 11 | Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 write-output “” > C:\temp\verteiler.txt get-distributiongroup | Sort -Property DisplayName | foreach { $name = $_.displayname $mailadresse = $_.PrimarySmtpAddress $output = ‘Group Name: ‘ + $Name + ' ' + $mailadresse write-output $output >> C:\temp\verteiler.txt Get-DistributionGroupMember $name | Sort -Property DisplayName | Select DisplayName, Alias, Department >> C:\temp\verteiler.txt write-output “” “” >> C:\temp\verteiler.txt } |