Friday, May 25, 2018

DL-members-export script


Get-ADGroupMember -Identity "GroupName" | Get-ADUser -Properties Displayname,Emailaddress,Title |Select samAccountName,Displayname,EmailAddress,Title

Get-DistributionGroup DLname@domain.com | select Displayname, Primarysmtpaddress |Export-CSV c:\DLMembersList.csv

Get-DistributionGroup -Identity DLNAME | Get-DistributionGroupMember |Select Displayname, primarysmtpaddress,name |Export-CSV c:\Members.csv

import-csv C:\user.csv | foreach-object {Get-Mailbox -Identity $_.name | select Displayname, Primarysmtpaddress |Export-CSV c:\UserEmail.csv

 Get-ADGroupMember -Identity  "GroupName" | select Samaccountname,Displayname,name

Get-ADGroupMember -Identity "GroupName" |Select samAccountName,Name,@{Name="DisplayName";Expression={(Get-ADUser $_.distinguishedName Properties Displayname).Displayname}},@{Name="Title";Expression={(Get-ADUser $_.distinguishedName -Properties Title).title}}

Get-Mailbox -Identity  MailboxName | select Displayname, Primarysmtpaddress

Get-ADGroupMember -Identity "GroupName" | Get-ADUser -Properties Displayname,Title |Select samAccountName,Name,Displayname,Primarysmtpaddress,Title


No comments:

Post a Comment